index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategy:1.0
//
final public class DispatchStrategyHolder implements org.omg.CORBA.portable.Streamable
{
public DispatchStrategy value;
public
DispatchStrategyHolder()
{
}
public
DispatchStrategyHolder(DispatchStrategy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = DispatchStrategyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
DispatchStrategyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return DispatchStrategyHelper.type();
}
}
| 6,300 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocateRequestPolicy.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocateRequestPolicy:1.0
//
/**
*
* The locate request policy. This policy can be used to specify
* whether the ORB sends locate request messages.
*
**/
public interface LocateRequestPolicy extends LocateRequestPolicyOperations,
org.omg.CORBA.Policy
{
}
| 6,301 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/BootManager:1.0
//
/**
*
* Interface to manage bootstrapping of objects.
*
**/
public interface BootManager extends BootManagerOperations,
org.omg.CORBA.Object
{
}
| 6,302 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryAttributes.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/RetryAttributes:1.0
//
/**
*
* The retry information
*
**/
final public class RetryAttributes implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:orb.yoko.apache.org/OB/RetryAttributes:1.0";
public
RetryAttributes()
{
}
public
RetryAttributes(short mode,
int interval,
int max,
boolean remote)
{
this.mode = mode;
this.interval = interval;
this.max = max;
this.remote = remote;
}
public short mode;
public int interval;
public int max;
public boolean remote;
}
| 6,303 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Assert.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class Assert {
public static void _OB_assert(boolean b) {
if (!b)
throw new AssertionFailed();
}
public static void _OB_assert(boolean b, String reason) {
if (!b)
throw new AssertionFailed(reason);
}
public static void _OB_assert(String reason) {
throw new AssertionFailed(reason);
}
public static void _OB_assert(Throwable ex) {
throw new AssertionFailed(ex);
}
public static void _OB_assert(String reason, Throwable ex) {
throw new AssertionFailed(reason, ex);
}
}
| 6,304 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectTimeoutPolicyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ConnectTimeoutPolicy:1.0
//
final public class ConnectTimeoutPolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, ConnectTimeoutPolicy val)
{
any.insert_Object(val, type());
}
public static ConnectTimeoutPolicy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "ConnectTimeoutPolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/ConnectTimeoutPolicy:1.0";
}
public static ConnectTimeoutPolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, ConnectTimeoutPolicy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static ConnectTimeoutPolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (ConnectTimeoutPolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,305 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UTF16Reader.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final class UTF16Reader extends CodeSetReader {
private int Flags_ = 0;
public char read_char(org.apache.yoko.orb.CORBA.InputStream in)
throws org.omg.CORBA.DATA_CONVERSION {
return (char) (in.buf_.data_[in.buf_.pos_++] & 0xff);
}
public char read_wchar(org.apache.yoko.orb.CORBA.InputStream in, int len)
throws org.omg.CORBA.DATA_CONVERSION {
if (OB_Extras.COMPAT_WIDE_MARSHAL == true) {
if (len == 2) {
return (char) ((in.buf_.data_[in.buf_.pos_++] << 8) | (in.buf_.data_[in.buf_.pos_++] & 0xff));
} else
throw new org.omg.CORBA.DATA_CONVERSION();
} else {
//
// read the first wchar assuming big endian
//
char v = (char) ((in.buf_.data_[in.buf_.pos_++] & 0xff) << 8);
v |= (char) ((in.buf_.data_[in.buf_.pos_++] & 0xff));
//
// check if this was a BOM
//
if (((Flags_ & CodeSetReader.FIRST_CHAR) != 0)
&& (v == (char) 0xFEFF)) {
//
// it was a big endian BOM
//
v = (char) ((in.buf_.data_[in.buf_.pos_++] & 0xff) << 8);
v |= (char) ((in.buf_.data_[in.buf_.pos_++] & 0xff));
} else if (((Flags_ & CodeSetReader.FIRST_CHAR) != 0)
&& (v == (char) 0xFFFE)) {
//
// it was a little endian BOM
//
v = (char) ((in.buf_.data_[in.buf_.pos_++] & 0xff));
v |= (char) ((in.buf_.data_[in.buf_.pos_++] & 0xff) << 8);
//
// enable the little endian reader flag
//
Flags_ |= CodeSetReader.L_ENDIAN;
} else if ((Flags_ & CodeSetReader.L_ENDIAN) != 0) {
//
// swap the character input
//
v = (char) (((v >>> 8) & 0xff) | ((v << 8) & 0xff));
}
//
// check for the surrogate paired character
//
if ((v >= (char) 0xD800) && (v <= (char) 0xDFFF)) {
//
// it was a surrogate paired character that we don't support
//
org.apache.yoko.orb.OB.Assert._OB_assert(false);
}
//
// turn off the first character reading
//
Flags_ &= ~CodeSetReader.FIRST_CHAR;
return v;
}
}
public int count_wchar(char first) {
if (OB_Extras.COMPAT_WIDE_MARSHAL == true) {
return 2;
} else {
//
// if we're the first character and this is a BOM, then we
// need to return 4
//
if (((Flags_ & CodeSetReader.FIRST_CHAR) != 0)
&& ((first == (char) 0xFEFF) || first == (char) 0xFFFE))
return 4;
return 2;
}
}
public void set_flags(int flags) {
Flags_ = flags;
}
}
| 6,306 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLSchemeOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/URLScheme:1.0
//
/**
*
* A URLScheme (e.g., <code>file:</code>, <code>corbaloc:</code>, etc.)
* is responsible for converting a URL into an object reference.
* All schemes must be installed in the <code>URLRegistry</code>.
*
* @see URLRegistry
*
**/
public interface URLSchemeOperations
{
//
// IDL:orb.yoko.apache.org/OB/URLScheme/name:1.0
//
/**
*
* Each scheme must have a unique name. All scheme names must
* be in lower case, and do not include the trailing colon.
*
**/
String
name();
//
// IDL:orb.yoko.apache.org/OB/URLScheme/parse_url:1.0
//
/**
*
* Convert a URL into an object reference.
*
* @param url The complete URL, including the scheme.
*
* @return An object reference.
*
* @exception BAD_PARAM In case the URL is invalid.
*
**/
org.omg.CORBA.Object
parse_url(String url);
//
// IDL:orb.yoko.apache.org/OB/URLScheme/destroy:1.0
//
/**
*
* Release any resources held by the object.
*
**/
void
destroy();
}
| 6,307 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyFactoryOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory:1.0
//
/**
*
* This interface is a factory to create dispatch strategies, and to
* manage thread pools.
*
* @see DispatchStrategy
*
**/
public interface DispatchStrategyFactoryOperations
{
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory/create_thread_pool:1.0
//
/**
*
* Create a thread pool containing nthreads.
*
* @param nthreads The number of threads the pool in the pool
*
**/
int
create_thread_pool(int nthreads);
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory/destroy_thread_pool:1.0
//
/**
*
* Destroy a thread pool with the given id. If the thread pool is
* is use by an object adapter any new requests will cause an
* <code>OBJ_ADAPTER</code> exception.
*
* @param id The thread pool id
*
* @exception org.apache.yoko.orb.OB.InvalidThreadPool If the thread pool id is valid.
*
**/
void
destroy_thread_pool(int id)
throws InvalidThreadPool;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory/create_thread_pool_strategy:1.0
//
/**
*
* Create a thread pool dispatch strategy.
*
* @param id The thread pool id
*
* @return A dispatch strategy
*
* @exception org.apache.yoko.orb.OB.InvalidThreadPool If the thread pool id is valid.
*
**/
DispatchStrategy
create_thread_pool_strategy(int id)
throws InvalidThreadPool;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory/create_same_thread_strategy:1.0
//
/**
*
* Create a same thread dispatch strategy.
*
* @return A dispatch strategy
*
**/
DispatchStrategy
create_same_thread_strategy();
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory/create_thread_per_request_strategy:1.0
//
/**
*
* Create a same thread per request dispatch strategy.
*
* @return A dispatch strategy
*
**/
DispatchStrategy
create_thread_per_request_strategy();
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory/create_default_dispatch_strategy:1.0
//
/**
*
* Create a default dispatch strategy. The default dispatch
* strategy is created according to the ooc.orb.oa.conc_model
* property.
*
* @return A dispatch strategy
*
**/
DispatchStrategy
create_default_dispatch_strategy();
}
| 6,308 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueFactoryManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.logging.Logger;
import java.util.logging.Level;
import org.apache.yoko.util.cmsf.RepIds;
public final class ValueFactoryManager {
static final Logger logger = Logger.getLogger(ValueFactoryManager.class.getName());
//
// The set of registered valuetype factories
//
private java.util.Hashtable factories_;
//
// Cached set of factories resolved by class (Java only)
//
private java.util.Hashtable classFactories_;
private boolean destroy_; // True if destroy() was called
// ----------------------------------------------------------------------
// ValueFactoryManager private and protected member implementations
// ----------------------------------------------------------------------
protected void finalize() throws Throwable {
Assert._OB_assert(destroy_);
super.finalize();
}
// ----------------------------------------------------------------------
// ValueFactoryManager package member implementations
// ----------------------------------------------------------------------
synchronized void destroy() {
Assert._OB_assert(!destroy_); // May only be destroyed once
//
// Destroy the hashtable
//
factories_ = null;
}
// ----------------------------------------------------------------------
// ValueFactoryManager public member implementations
// ----------------------------------------------------------------------
public ValueFactoryManager() {
//
// Create the hashtables
//
factories_ = new java.util.Hashtable(1023);
classFactories_ = new java.util.Hashtable(1023);
//
// Install factories for standard value box types
//
registerValueFactory(org.omg.CORBA.StringValueHelper.id(),
new org.apache.yoko.orb.CORBA.StringValueFactory());
registerValueFactory(org.omg.CORBA.WStringValueHelper.id(),
new org.apache.yoko.orb.CORBA.WStringValueFactory());
}
public synchronized org.omg.CORBA.portable.ValueFactory registerValueFactory(
String id, org.omg.CORBA.portable.ValueFactory factory) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_)
throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes
.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
Assert._OB_assert(id != null && factory != null);
org.omg.CORBA.portable.ValueFactory old = (org.omg.CORBA.portable.ValueFactory) factories_
.get(id);
factories_.put(id, factory);
return old;
}
public synchronized void unregisterValueFactory(String id) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_)
throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes
.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
Assert._OB_assert(id != null);
if (factories_.remove(id) == null)
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorValueFactoryError)
+ ": " + id, org.apache.yoko.orb.OB.MinorCodes.MinorValueFactoryError,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public synchronized org.omg.CORBA.portable.ValueFactory lookupValueFactory(
String id) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_)
throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes
.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
Assert._OB_assert(id != null);
return (org.omg.CORBA.portable.ValueFactory) factories_.get(id);
}
// Java-specific method
public org.omg.CORBA.portable.ValueFactory lookupValueFactoryWithClass(String id) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_)
{
throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes
.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
Assert._OB_assert(id != null);
org.omg.CORBA.portable.ValueFactory result;
logger.fine("Looking up value factory for class " + id);
//
// Check the registered factories
//
result = (org.omg.CORBA.portable.ValueFactory) factories_.get(id);
if (result != null) {
logger.finer("Returning registered value factory " + result.getClass().getName());
return result;
}
//
// Check the cached factories
//
result = (org.omg.CORBA.portable.ValueFactory) classFactories_.get(id);
if (result != null) {
logger.finer("Returning cached value factory " + result.getClass().getName());
return result;
}
//
// Try to convert the repository ID into a class name.
//
Class c = RepIds.query(id).suffix("DefaultFactory").toClass();
if (c != null) {
try {
logger.finer("Attempting to create value factory from class " + c.getName());
//
// Instantiate the factory
//
result = (org.omg.CORBA.portable.ValueFactory) c.newInstance();
//
// Cache the result
//
classFactories_.put(id, result);
} catch (ClassCastException ex) {
// ignore
} catch (InstantiationException ex) {
// ignore
} catch (IllegalAccessException ex) {
// ignore
}
}
return result;
}
}
| 6,309 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PluginManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.osgi.ProviderLocator;
public final class PluginManager {
//
// The ORB
//
private org.omg.CORBA.ORB orb_;
//
// Plug-in data
//
static class PluginData {
public String name;
public org.apache.yoko.orb.OCI.Plugin plugin;
PluginData(String name, org.apache.yoko.orb.OCI.Plugin plugin) {
this.name = name;
this.plugin = plugin;
}
}
//
// The set of registered plug-ins
//
private java.util.Vector plugins_ = new java.util.Vector();
private boolean destroy_; // True if destroy() was called
// ----------------------------------------------------------------------
// PluginManager public member implementations
// ----------------------------------------------------------------------
public PluginManager(org.omg.CORBA.ORB orb) {
orb_ = orb;
destroy_ = false;
}
//
// Destroy the PluginManager
//
public void destroy() {
Assert._OB_assert(!destroy_); // May only be destroyed once
destroy_ = true;
//
// Destroy the plug-ins
//
plugins_.removeAllElements();
//
// Eliminate circular reference
//
orb_ = null;
}
//
// Initialize the plug-in with the given name. The plug-in may be
// loaded dynamically. If the plug-in could not be initialized,
// nil is returned.
//
public org.apache.yoko.orb.OCI.Plugin initPlugin(String name,
org.omg.CORBA.StringSeqHolder args) {
org.apache.yoko.orb.OCI.Plugin result = null;
for (int i = 0; i < plugins_.size(); i++) {
PluginData data = (PluginData) plugins_.elementAt(i);
if (name.equals(data.name)) {
result = data.plugin;
break;
}
}
if (result == null) {
//
// Try to load the plug-in dynamically
//
String className;
//
// First check the properties to see if there is a property
// with the name yoko.oci.plugin.<name>, which specifies the
// class from which this plug-in should be loaded
//
org.apache.yoko.orb.CORBA.ORB oborb = (org.apache.yoko.orb.CORBA.ORB) orb_;
java.util.Properties props = oborb.properties();
String propName = "yoko.oci.plugin." + name;
className = props.getProperty(propName);
if (className == null) {
//
// No property was found, so compose the class name using
// a standard format: org.apache.yoko.orb.OCI.<name>
//
className = "org.apache.yoko.orb.OCI." + name;
}
Logger logger = oborb.logger();
//
// Load the class
//
org.apache.yoko.orb.OCI.PluginInit pi = null;
try {
// get the appropriate class for the loading.
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class c = ProviderLocator.loadClass(className, this.getClass(), loader);
pi = (org.apache.yoko.orb.OCI.PluginInit) c.newInstance();
} catch (org.omg.CORBA.SystemException ex) {
throw ex;
} catch (Exception ex) {
String err = "unable to load OCI plug-in `" + name + "':\n"
+ ex.getMessage();
logger.error(err, ex);
return null;
}
//
// Invoke the version function, which allows the plug-in
// to verify that it is compatible with the OCI version
// in use by the ORB
//
pi.version(orb_, org.apache.yoko.orb.OCI.Version.value);
//
// Invoke the initialization function
//
result = pi.init(orb_, args);
if (result != null)
plugins_.addElement(new PluginData(name, result));
}
return result;
}
}
| 6,310 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ORBInstance.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Phaser;
import org.apache.yoko.orb.OCI.ConnectorInfo;
import org.apache.yoko.util.Cache;
import org.apache.yoko.util.concurrent.ReferenceCountedCache;
import org.apache.yoko.util.concurrent.WeakCountedCache;
public final class ORBInstance {
private boolean destroy_; // True if destroy() was called
private static final Cache.Cleaner<GIOPConnection> CLEANER = new Cache.Cleaner<GIOPConnection>() {
@Override
public void clean(GIOPConnection conn) {
conn.destroy();
}
};
private final Cache<ConnectorInfo, GIOPConnection> outboundConnectionCache = new WeakCountedCache<>(CLEANER, 0, 100);
private org.omg.CORBA.ORB orb_;
//
// The native codesets
//
private int nativeCs_;
private int nativeWcs_;
//
// The default wchar codeset (should be 0 according to specification)
//
private int defaultWcs_;
//
// The ORB id
//
private String orbId_;
//
// The Server id
//
private String serverId_;
//
// The Server instance-id
//
private String serverInstance_;
private ObjectFactory objectFactory_;
private ClientManager clientManager_;
private PolicyFactoryManager policyFactoryManager_;
private PIManager interceptorManager_;
private InitialServiceManager initServiceManager_;
private ValueFactoryManager valueFactoryManager_;
private org.omg.IOP.CodecFactory codecFactory_;
private org.apache.yoko.orb.OBPortableServer.POAManagerFactory pmFactory_;
private MultiRequestSender multiRequestSender_;
private java.util.Properties properties_;
private DispatchStrategyFactory dispatchStrategyFactory_;
private BootManager bootManager_;
private Logger logger_;
private CoreTraceLevels coreTraceLevels_;
private RecursiveMutex orbSyncMutex_ = new RecursiveMutex();
private ExecutorService serverExecutor_;
private Phaser serverPhaser = new Phaser(1);
private ExecutorService clientExecutor_;
private Phaser clientPhaser = new Phaser(1);
private org.apache.yoko.orb.OCI.ConFactoryRegistry conFactoryRegistry_;
private org.apache.yoko.orb.OCI.AccFactoryRegistry accFactoryRegistry_;
private UnknownExceptionStrategy unknownExceptionStrategy_;
private URLRegistry urlRegistry_;
private boolean useTypeCodeCache_;
private boolean extendedWchar_;
//
// the async message handler
//
OrbAsyncHandler asyncHandler_ = null;
// ----------------------------------------------------------------------
// ORBInstance private and protected member implementations
// ----------------------------------------------------------------------
protected void finalize() throws Throwable {
Assert._OB_assert(destroy_);
super.finalize();
}
// ----------------------------------------------------------------------
// ORBInstance package member implementations
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ORBInstance public member implementations
// ----------------------------------------------------------------------
public ORBInstance(org.omg.CORBA.ORB orb, String orbId, String serverId,
String serverInstance, ObjectFactory objectFactory,
ClientManager clientManager,
PolicyFactoryManager policyFactoryManager, PIManager piManager,
InitialServiceManager initServiceManager,
ValueFactoryManager valueFactoryManager,
org.omg.IOP.CodecFactory codecFactory,
org.apache.yoko.orb.OBPortableServer.POAManagerFactory pmFactory,
MultiRequestSender multiRequestSender,
java.util.Properties properties,
DispatchStrategyFactory dispatchStrategyFactory,
BootManager bootManager, Logger logger,
CoreTraceLevels coreTraceLevels,
org.apache.yoko.orb.OCI.ConFactoryRegistry conFactoryRegistry,
org.apache.yoko.orb.OCI.AccFactoryRegistry accFactoryRegistry,
UnknownExceptionStrategy unknownExceptionStrategy,
URLRegistry urlRegistry, int nativeCs, int nativeWcs, int defaultWcs) {
orb_ = orb;
orbId_ = orbId;
serverId_ = serverId;
serverInstance_ = serverInstance;
objectFactory_ = objectFactory;
clientManager_ = clientManager;
policyFactoryManager_ = policyFactoryManager;
interceptorManager_ = piManager;
initServiceManager_ = initServiceManager;
valueFactoryManager_ = valueFactoryManager;
codecFactory_ = codecFactory;
pmFactory_ = pmFactory;
multiRequestSender_ = multiRequestSender;
properties_ = properties;
dispatchStrategyFactory_ = dispatchStrategyFactory;
bootManager_ = bootManager;
logger_ = logger;
coreTraceLevels_ = coreTraceLevels;
conFactoryRegistry_ = conFactoryRegistry;
accFactoryRegistry_ = accFactoryRegistry;
unknownExceptionStrategy_ = unknownExceptionStrategy;
urlRegistry_ = urlRegistry;
nativeCs_ = nativeCs;
nativeWcs_ = nativeWcs;
defaultWcs_ = defaultWcs;
//
// Create the server and client executors
// TODO why are these separate?
//
clientExecutor_ = Executors.newCachedThreadPool();
serverExecutor_ = Executors.newCachedThreadPool();
//
// Use the TypeCode cache?
//
String tcc = properties_.getProperty("yoko.orb.use_type_code_cache");
if (tcc != null && tcc.equals("false"))
useTypeCodeCache_ = false;
else
useTypeCodeCache_ = true;
//
// Support wchar/wstring for IIOP 1.0?
//
String extWchar = properties_.getProperty("yoko.orb.extended_wchar");
if (extWchar != null && extWchar.equals("true"))
extendedWchar_ = true;
else
extendedWchar_ = false;
//
// get the number of AMI worker threads
//
String amiWorkersStr = properties_.getProperty("yoko.orb.ami_workers");
int amiWorkers = 1;
if (amiWorkersStr != null) {
amiWorkers = Integer.parseInt(amiWorkersStr);
if (amiWorkers <= 0)
amiWorkers = 1;
}
//
// the Asynchonous message handler
//
asyncHandler_ = new OrbAsyncHandler(amiWorkers);
}
public void destroy() {
Assert._OB_assert(!destroy_); // May only be destroyed once
destroy_ = true;
//
// Destroy the POAManagerFactory
//
pmFactory_.destroy();
pmFactory_ = null;
//
// Destroy the Initial Service manager
//
initServiceManager_.destroy();
initServiceManager_ = null;
//
// Destroy the Object factory
//
objectFactory_.destroy();
objectFactory_ = null;
//
// Destroy the ClientManager
//
// ORBControl destroys the ClientManager
// clientManager_.destroy();
clientManager_ = null;
//
// Destroy the PolicyFactoryManager
//
policyFactoryManager_.destroy();
policyFactoryManager_ = null;
//
// Destroy the PortableInterceptor manager
//
interceptorManager_.destroy();
interceptorManager_ = null;
//
// Destroy the ValueFactory manager
//
valueFactoryManager_.destroy();
valueFactoryManager_ = null;
//
// Destroy the CodecFactory
//
// codecFactory_.destroy(); // No destroy operation defined
codecFactory_ = null;
//
// Destroy the MultiRequestSender factory
//
// multiRequestSender_.destroy(); // No destroy operation defined
multiRequestSender_ = null;
//
// Properties are not destroyed -- they are indestructible
//
// properties_.destroy(); // No destroy operation defined
// properties_ = null;
//
// Destroy the dispatch strategy factory
//
// NOTE: destruction is taken care of in ORBControl
//
// ((DispatchStrategyFactory_impl)dispatchStrategyFactory_).
// _OB_destroy();
dispatchStrategyFactory_ = null;
//
// Destroy the BootManager
//
// bootManager_.destroy(); // No destroy operation defined
bootManager_ = null;
//
// Logger is not destroyed -- it is indestructible
//
// logger_.destroy();
// logger_ = null;
//
// CoreTraceLevels is not destroyed -- it is indestructible
//
// coreTraceLevels_.destroy();
// coreTraceLevels_ = null;
// Client and server executors shut down in the ORBControl
//
// Destroy the ConFactoryRegistry
//
// conFactoryRegistry_.destroy(); // No destroy operation defined
conFactoryRegistry_ = null;
//
// Destroy the AccFactoryRegistry
//
// accFactoryRegistry_.destroy(); // No destroy operation defined
accFactoryRegistry_ = null;
//
// Destroy the UnknownExceptionStrategy
//
unknownExceptionStrategy_.destroy();
unknownExceptionStrategy_ = null;
//
// Destroy the Asynchonous message handler
//
asyncHandler_.shutdown();
asyncHandler_ = null;
}
//
// IMPORTANT: Only use this when required by the Java mapping
//
public org.omg.CORBA.ORB getORB() {
return orb_;
}
public int getNativeCs() {
return nativeCs_;
}
public int getNativeWcs() {
return nativeWcs_;
}
public int getDefaultWcs() {
return defaultWcs_;
}
public ObjectFactory getObjectFactory() {
return objectFactory_;
}
public ClientManager getClientManager() {
return clientManager_;
}
public PolicyFactoryManager getPolicyFactoryManager() {
return policyFactoryManager_;
}
public PIManager getPIManager() {
return interceptorManager_;
}
public InitialServiceManager getInitialServiceManager() {
return initServiceManager_;
}
public ValueFactoryManager getValueFactoryManager() {
return valueFactoryManager_;
}
public org.omg.IOP.CodecFactory getCodecFactory() {
return codecFactory_;
}
public org.apache.yoko.orb.OBPortableServer.POAManagerFactory getPOAManagerFactory() {
return pmFactory_;
}
public MultiRequestSender getMultiRequestSender() {
return multiRequestSender_;
}
public java.util.Properties getProperties() {
return properties_;
}
public DispatchStrategyFactory getDispatchStrategyFactory() {
return dispatchStrategyFactory_;
}
public BootManager getBootManager() {
return bootManager_;
}
public Logger getLogger() {
return logger_;
}
public CoreTraceLevels getCoreTraceLevels() {
return coreTraceLevels_;
}
public RecursiveMutex getORBSyncMutex() {
return orbSyncMutex_;
}
public ExecutorService getServerExecutor() {
return serverExecutor_;
}
public Phaser getServerPhaser() {
return serverPhaser;
}
public ExecutorService getClientExecutor() {
return clientExecutor_;
}
public Phaser getClientPhaser() {
return clientPhaser;
}
public org.apache.yoko.orb.OCI.ConFactoryRegistry getConFactoryRegistry() {
return conFactoryRegistry_;
}
public org.apache.yoko.orb.OCI.AccFactoryRegistry getAccFactoryRegistry() {
return accFactoryRegistry_;
}
public UnknownExceptionStrategy getUnknownExceptionStrategy() {
return unknownExceptionStrategy_;
}
public UnknownExceptionStrategy setUnknownExceptionStrategy(
UnknownExceptionStrategy strategy) {
UnknownExceptionStrategy result = unknownExceptionStrategy_;
unknownExceptionStrategy_ = strategy;
return result;
}
public URLRegistry getURLRegistry() {
return urlRegistry_;
}
public String getOrbId() {
return orbId_;
}
public String getServerId() {
return serverId_;
}
public String getServerInstance() {
return serverInstance_;
}
public boolean useTypeCodeCache() {
return useTypeCodeCache_;
}
public boolean extendedWchar() {
return extendedWchar_;
}
public OrbAsyncHandler getAsyncHandler() {
return asyncHandler_;
}
public Cache<ConnectorInfo, GIOPConnection> getOutboundConnectionCache() {return outboundConnectionCache;}
}
| 6,311 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocateRequestPolicyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocateRequestPolicy:1.0
//
/**
*
* The locate request policy. This policy can be used to specify
* whether the ORB sends locate request messages.
*
**/
public interface LocateRequestPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:orb.yoko.apache.org/OB/LocateRequestPolicy/value:1.0
//
/**
*
* If an object has a <code>LocateRequestPolicy</code> set to
* <code>false</code> then the ORB will not send locate request
* messages for the object.
*
**/
boolean
value();
}
| 6,312 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/IORURLScheme_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.URLScheme;
public class IORURLScheme_impl extends org.omg.CORBA.LocalObject implements
URLScheme {
private ORBInstance orbInstance_;
// ------------------------------------------------------------------
// IORURLScheme_impl constructor
// ------------------------------------------------------------------
public IORURLScheme_impl(ORBInstance orbInstance) {
orbInstance_ = orbInstance;
}
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public String name() {
return "ior";
}
public org.omg.CORBA.Object parse_url(String url) {
int len = url.length() - 4; // skip "IOR:"
if ((len % 2) != 0)
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid length",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
byte[] data = HexConverter.asciiToOctets(url, 4);
try {
//
// Error in conversion
//
if (data == null)
throw new org.omg.CORBA.MARSHAL();
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
org.omg.IOP.IOR ior = org.omg.IOP.IORHelper.read(in);
ObjectFactory objectFactory = orbInstance_.getObjectFactory();
return objectFactory.createObject(ior);
} catch (org.omg.CORBA.MARSHAL ex) {
//
// In this case, a marshal error is really a bad "IOR:..." string
//
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid IOR \"" + url + "\"", org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
public void destroy() {
orbInstance_ = null;
}
}
| 6,313 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/URLScheme.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/URLScheme:1.0
//
/**
*
* A URLScheme (e.g., <code>file:</code>, <code>corbaloc:</code>, etc.)
* is responsible for converting a URL into an object reference.
* All schemes must be installed in the <code>URLRegistry</code>.
*
* @see URLRegistry
*
**/
public interface URLScheme extends URLSchemeOperations,
org.omg.CORBA.Object
{
}
| 6,314 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/TypeCodeCache.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.Hashtable;
public final class TypeCodeCache {
private Hashtable cache_; // The type code cache hashtable
static private TypeCodeCache instance_ = null; // Singleton instance
private static final Object instanceMutex_ = new Object();
// ----------------------------------------------------------------------
// ORBInstance public member implementation
// ----------------------------------------------------------------------
TypeCodeCache() {
cache_ = new Hashtable(63);
}
static public TypeCodeCache instance() {
synchronized (instanceMutex_) {
if (instance_ == null) {
instance_ = new TypeCodeCache();
}
}
return instance_;
}
synchronized public org.apache.yoko.orb.CORBA.TypeCode get(String id) {
return (org.apache.yoko.orb.CORBA.TypeCode) cache_.get(id);
}
synchronized public void put(String id,
org.apache.yoko.orb.CORBA.TypeCode tc) {
if (cache_.containsKey(id))
return;
cache_.put(id, tc);
}
}
| 6,315 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ZeroPortPolicy.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ZeroPortPolicy:1.0
//
/**
*
* The zero port policy. This policy determines whether
* object IORs will have a zero port number in the IIOP profile.
*
**/
public interface ZeroPortPolicy extends ZeroPortPolicyOperations,
org.omg.CORBA.Policy
{
}
| 6,316 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectTimeoutPolicyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ConnectTimeoutPolicy:1.0
//
final public class ConnectTimeoutPolicyHolder implements org.omg.CORBA.portable.Streamable
{
public ConnectTimeoutPolicy value;
public
ConnectTimeoutPolicyHolder()
{
}
public
ConnectTimeoutPolicyHolder(ConnectTimeoutPolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = ConnectTimeoutPolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
ConnectTimeoutPolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return ConnectTimeoutPolicyHelper.type();
}
}
| 6,317 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootLocator.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/BootLocator:1.0
//
/**
*
* Interface used by BootManager to assist in locating objects.
*
* @see BootManager
*
**/
public interface BootLocator extends BootLocatorOperations,
org.omg.CORBA.Object
{
}
| 6,318 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategy:1.0
//
final public class DispatchStrategyHelper
{
public static void
insert(org.omg.CORBA.Any any, DispatchStrategy val)
{
any.insert_Object(val, type());
}
public static DispatchStrategy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "DispatchStrategy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/DispatchStrategy:1.0";
}
public static DispatchStrategy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, DispatchStrategy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static DispatchStrategy
narrow(org.omg.CORBA.Object val)
{
try
{
return (DispatchStrategy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,319 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ObjectFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.logging.Level;
import java.util.logging.Logger;
public final class ObjectFactory {
static final Logger logger = Logger.getLogger(ObjectFactory.class.getName());
private boolean destroy_; // True if destroy() was called
ORBInstance orbInstance_; // The ORBInstance object
org.omg.CORBA.PolicyManager policyManager_; // The PolicyManager object
// ----------------------------------------------------------------------
// ObjectFactory private and protected member implementations
// ----------------------------------------------------------------------
protected void finalize() throws Throwable {
Assert._OB_assert(destroy_);
super.finalize();
}
// ----------------------------------------------------------------------
// ObjectFactory package member implementations
// ----------------------------------------------------------------------
void destroy() {
Assert._OB_assert(!destroy_);
destroy_ = true;
//
// Set the ORBInstance object to nil
//
orbInstance_ = null;
//
// Set the PolicyManager object to nil
//
policyManager_ = null;
}
// ----------------------------------------------------------------------
// ObjectFactory public member implementations
// ----------------------------------------------------------------------
public void setORBInstance(ORBInstance orbInstance) {
orbInstance_ = orbInstance;
}
public void setPolicyManager(org.omg.CORBA.PolicyManager policyManager) {
policyManager_ = policyManager;
}
public org.omg.CORBA.Object createObject(org.omg.IOP.IOR ior) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_) {
throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes
.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
//
// Check for nil object reference
//
if (ior.type_id.length() == 0 && ior.profiles.length == 0) {
return null;
}
logger.fine("Creating an object of type " + ior.type_id);
//
// Create new delegate, set policies and change delegate
//
RefCountPolicyList policyList = new RefCountPolicyList(policies());
org.apache.yoko.orb.CORBA.Delegate p = new org.apache.yoko.orb.CORBA.Delegate(
orbInstance_, ior, ior, policyList);
//
// Create new object, set the delegate and return
//
org.omg.CORBA.portable.ObjectImpl obj;
if(ior.type_id.startsWith("RMI")) {
obj = new org.apache.yoko.orb.CORBA.StubForRemote();
}
else {
obj = new org.apache.yoko.orb.CORBA.StubForObject();
}
obj._set_delegate(p);
return obj;
}
public org.omg.CORBA.Object stringToObject(String ior) {
logger.fine("Creating an object from " + ior);
return orbInstance_.getURLRegistry().parse_url(ior);
}
public org.omg.CORBA.Policy[] policies() {
int[] ts = new int[0];
return policyManager_.get_policy_overrides(ts);
}
}
| 6,320 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionInfo_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.UnknownExceptionInfo;
public class UnknownExceptionInfo_impl extends org.omg.CORBA.LocalObject
implements UnknownExceptionInfo {
private String operation_;
private boolean responseExpected_;
private org.apache.yoko.orb.OCI.TransportInfo transportInfo_;
private RuntimeException ex_;
// ------------------------------------------------------------------
// UnknownExceptionInfo_impl constructor
// ------------------------------------------------------------------
public UnknownExceptionInfo_impl(String operation,
boolean responseExpected,
org.apache.yoko.orb.OCI.TransportInfo transportInfo,
RuntimeException ex) {
operation_ = operation;
responseExpected_ = responseExpected;
transportInfo_ = transportInfo;
ex_ = ex;
}
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public String operation() {
return operation_;
}
public boolean response_expected() {
return responseExpected_;
}
public org.apache.yoko.orb.OCI.TransportInfo transport_info() {
return transportInfo_;
}
public String describe_exception() {
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
ex_.printStackTrace(pw);
pw.flush();
return sw.toString();
}
public void raise_exception() {
throw ex_;
}
}
| 6,321 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/InterceptorPolicyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/InterceptorPolicy:1.0
//
final public class InterceptorPolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, InterceptorPolicy val)
{
any.insert_Object(val, type());
}
public static InterceptorPolicy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "InterceptorPolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/InterceptorPolicy:1.0";
}
public static InterceptorPolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, InterceptorPolicy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static InterceptorPolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (InterceptorPolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,322 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RuntimeLocationForward.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// This exception should ONLY be used when the ORB needs to bypass
// a standardized API. The checked exception LocationForward should be
// used in all other cases.
//
final public class RuntimeLocationForward extends RuntimeException {
public org.omg.IOP.IOR ior; // Forwarded IOR
public boolean perm; // Is this a LOCATION_FORWARD_PERM?
public RuntimeLocationForward(org.omg.IOP.IOR i, boolean p) {
ior = i;
perm = p;
}
}
| 6,323 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchRequestHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchRequest:1.0
//
final public class DispatchRequestHelper
{
public static void
insert(org.omg.CORBA.Any any, DispatchRequest val)
{
any.insert_Object(val, type());
}
public static DispatchRequest
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "DispatchRequest");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/DispatchRequest:1.0";
}
public static DispatchRequest
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, DispatchRequest val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static DispatchRequest
narrow(org.omg.CORBA.Object val)
{
try
{
return (DispatchRequest)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,324 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocURLScheme_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.CorbalocProtocol;
import org.apache.yoko.orb.OB.CorbalocURLScheme;
public class CorbalocURLScheme_impl extends org.omg.CORBA.LocalObject implements
CorbalocURLScheme {
private ORBInstance orbInstance_;
private java.util.Hashtable protocols_ = new java.util.Hashtable();
// ------------------------------------------------------------------
// CorbalocURLScheme_impl private member implementations
// ------------------------------------------------------------------
private static byte[] stringToKey(String keyStr) {
byte[] result = new byte[keyStr.length()];
for (int i = 0; i < result.length; i++) {
char ch = keyStr.charAt(i);
if (ch > 255) {
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid character in key, char value = 0x" + Integer.toHexString(ch),
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
result[i] = (byte) ch;
}
return result;
}
private org.omg.CORBA.Object parse_addresses(String str, int startIdx,
int endIdx, String keyStr) {
//
// Check for rir:
//
if (str.substring(startIdx, startIdx + 4).equals("rir:")) {
int comma = str.indexOf(',', startIdx);
if (comma != -1 && comma <= endIdx) {
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": rir cannot be used with other protocols",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
if (startIdx + 3 != endIdx) {
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress)
+ ": rir does not allow an address",
org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
try {
InitialServiceManager initialServiceManager = orbInstance_.getInitialServiceManager();
return initialServiceManager.resolveInitialReferences(keyStr);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid initial reference token \"" + keyStr + "\"",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
//
// Unescape stringified object key and convert to octets
//
byte[] key = stringToKey(URLUtil.unescapeURL(keyStr));
//
// Convert addresses (separated by ',') into IOR profiles
//
java.util.Vector profiles = new java.util.Vector();
int pos = startIdx;
while (pos <= endIdx) {
//
// Get the protocol identifier - we'll assume that protocols are
// terminated by a ':'
//
String protocol;
int colon = str.indexOf(':', pos);
if (colon == -1) {
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": no protocol",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
else if (colon > endIdx) {
break;
}
if (colon == pos) {// ":" is shorthand for "iiop:"
protocol = "iiop";
}
else {
protocol = str.substring(pos, colon).toLowerCase();
}
pos = colon;
//
// Check for rir (again)
//
if (protocol.equals("rir")) {
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": rir cannot be used with other protocols",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
//
// Get the protocol address
//
String addr;
if (pos == endIdx) {
addr = "";
pos++;
} else {
int addrStart = pos + 1; // skip ':'
int addrEnd;
int comma = str.indexOf(',', addrStart);
if (comma == -1 || comma > endIdx) {
addrEnd = endIdx;
pos = endIdx + 1;
} else {
addrEnd = comma - 1;
pos = comma + 1;
}
addr = str.substring(addrStart, addrEnd + 1);
}
//
// Find the protocol object
//
CorbalocProtocol p = find_protocol(protocol);
if (p != null) {
org.omg.IOP.TaggedProfile profile = p.parse_address(addr, key);
profiles.addElement(profile);
}
}
if (profiles.size() == 0) {
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": no valid protocol addresses",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
org.omg.IOP.IOR ior = new org.omg.IOP.IOR();
ior.type_id = "";
ior.profiles = new org.omg.IOP.TaggedProfile[profiles.size()];
profiles.copyInto(ior.profiles);
ObjectFactory objectFactory = orbInstance_.getObjectFactory();
return objectFactory.createObject(ior);
}
// ------------------------------------------------------------------
// CorbalocURLScheme_impl constructor
// ------------------------------------------------------------------
public CorbalocURLScheme_impl(ORBInstance orbInstance) {
orbInstance_ = orbInstance;
}
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public String name() {
return "corbaloc";
}
public org.omg.CORBA.Object parse_url(String url) {
//
// Get the object key
//
int slash = url.indexOf('/');
//
// Although an object key is optional according to the specification,
// we consider this to be an invalid URL
//
if (slash == -1) {
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorOther)
+ ": no key specified", org.apache.yoko.orb.OB.MinorCodes.MinorOther,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
int addrStart = 9; // skip "corbaloc:"
int addrEnd = slash - 1;
if (addrStart == slash) {
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress)
+ ": no protocol address", org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
String key = url.substring(slash + 1);
return parse_addresses(url, addrStart, addrEnd, key);
}
public void destroy() {
java.util.Enumeration e = protocols_.elements();
while (e.hasMoreElements()) {
CorbalocProtocol protocol = (CorbalocProtocol) e.nextElement();
protocol.destroy();
}
protocols_.clear();
orbInstance_ = null;
}
public void add_protocol(CorbalocProtocol protocol)
throws org.apache.yoko.orb.OB.CorbalocURLSchemePackage.ProtocolAlreadyExists {
String name = protocol.name();
if (protocols_.containsKey(name)) {
throw new org.apache.yoko.orb.OB.CorbalocURLSchemePackage.ProtocolAlreadyExists();
}
protocols_.put(name, protocol);
}
public CorbalocProtocol find_protocol(String name) {
return (CorbalocProtocol) protocols_.get(name);
}
}
| 6,325 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionInfoOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo:1.0
//
/**
*
* Information about the context in which the unknown exception occurred.
*
**/
public interface UnknownExceptionInfoOperations
{
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo/operation:1.0
//
/**
*
* The name of the operation that the servant was executing.
*
* @return The operation name.
*
**/
String
operation();
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo/response_expected:1.0
//
/**
*
* Indicates whether the client is expecting a response to
* this invocation.
*
* @return TRUE if the client expects a response, FALSE otherwise.
*
**/
boolean
response_expected();
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo/transport_info:1.0
//
/**
*
* Obtains information about the transport on which this request
* was received.
*
* @return The transport information, or NULL if the request
* was made on a collocated servant.
*
**/
org.apache.yoko.orb.OCI.TransportInfo
transport_info();
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo/describe_exception:1.0
//
/**
*
* Obtains a description of the exception. For example, in
* Java this returns the exception stack trace. Calling
* this operation in C++ will raise CORBA::NO_IMPLEMENT.
*
* @return The exception description.
*
**/
String
describe_exception();
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo/raise_exception:1.0
//
/**
*
* Raises the unknown exception.
*
**/
void
raise_exception();
}
| 6,326 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocationForward.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class LocationForward extends Exception {
public org.omg.IOP.IOR ior; // Forwarded IOR
public boolean perm; // Is this a LOCATION_FORWARD_PERM?
public LocationForward(org.omg.IOP.IOR i, boolean p) {
ior = i;
perm = p;
}
}
| 6,327 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ProtocolPolicyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ProtocolPolicy:1.0
//
/**
*
* The protocol policy. This policy specifies the order in which profiles
* should be tried.
*
**/
public interface ProtocolPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:orb.yoko.apache.org/OB/ProtocolPolicy/value:1.0
//
/**
*
* If a <code>ProtocolPolicy</code> is set, then the value specifies
* the list of plugins that may be used. The profiles of an IOR will
* be used in the order specified by this policy. If no profile in an
* IOR matches any of the plugins specified by this policy, a
* <code>CORBA::TRANSIENT</code> exception will be raised. By
* default, the ORB chooses the protocol to be used.
*
**/
String[]
value();
//
// IDL:orb.yoko.apache.org/OB/ProtocolPolicy/contains:1.0
//
/**
*
* Determines if this policy includes the given plugin id.
*
**/
boolean
contains(String id);
}
| 6,328 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategy:1.0
//
/**
*
* This interface represents a dispatch strategy. To dispatch a
* request the ORB will pass a DispatchRequest. The dispatch strategy
* should call DispatchRequest::invoke() in the correct thread
* context.
*
* @see DispatchRequest
* @see DispatchStrategyFactory
*
**/
public interface DispatchStrategyOperations
{
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategy/id:1.0
//
/**
*
* Determine the id of this DispatchStrategy. The ids of the
* built-in DispatchStrategy objects are <code>SAME_THREAD</code>,
* <code>THREAD_PER_REQUEST</code> and <code>THREAD_POOL</code>.
* Use DispatchStrategyFactory to create instances of these objects.
*
**/
int
id();
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategy/info:1.0
//
/**
*
* Determine information specific to this DispatchStrategy.
*
**/
org.omg.CORBA.Any
info();
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategy/dispatch:1.0
//
/**
*
* Called to cause a DispatchRequest to be run.
*
* @param r The request to execute.
*
**/
void
dispatch(DispatchRequest r);
}
| 6,329 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPServer.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.logging.Logger;
final class GIOPServer extends Server {
static final Logger logger = Logger.getLogger(GIOPServer.class.getName());
protected ORBInstance orbInstance_; // The ORB Instance
protected boolean destroy_; // True if destroy() was called
protected org.apache.yoko.orb.OCI.Acceptor acceptor_; // The acceptor
protected OAInterface oaInterface_; // The object adapter interface
protected GIOPServerStarter starter_; // The server starter
// ----------------------------------------------------------------------
// GIOPServer private and protected member implementations
// ----------------------------------------------------------------------
protected void finalize() throws Throwable {
Assert._OB_assert(destroy_);
Assert._OB_assert(starter_ == null);
super.finalize();
}
// ----------------------------------------------------------------------
// GIOPServer package member implementations
// ----------------------------------------------------------------------
GIOPServer(ORBInstance orbInstance,
org.apache.yoko.orb.OCI.Acceptor acceptor, OAInterface oaInterface,
int concModel) {
super(concModel);
orbInstance_ = orbInstance;
destroy_ = false;
acceptor_ = acceptor;
oaInterface_ = oaInterface;
logger.fine("GIOPServer " + System.identityHashCode(this) + " created for orb instance " + orbInstance_.getOrbId() + " and server " + orbInstance_.getServerId() + " identityHash=" + System.identityHashCode(orbInstance_));
try {
switch (concModel_) {
case Threaded:
starter_ = new GIOPServerStarterThreaded(orbInstance_,
acceptor_, oaInterface_);
break;
}
} catch (RuntimeException ex) {
destroy_ = true;
throw ex;
}
}
//
// Destroy the server
//
public void destroy() {
logger.fine("Destroying GIOPServer " + System.identityHashCode(this) + " started for orb instance " + orbInstance_.getOrbId() + " and server " + orbInstance_.getServerId() + System.identityHashCode(orbInstance_));
//
// Don't destroy twice
//
if (destroy_)
return;
//
// Set the destroy flag
//
destroy_ = true;
//
// Close and remove the starter
//
Assert._OB_assert(starter_ != null);
starter_.setState(GIOPServerStarter.StateClosed);
starter_ = null;
}
//
// Hold any new requests that arrive for the Server
//
public void hold() {
logger.fine("Holding GIOPServer " + System.identityHashCode(this) + " started for orb instance " + orbInstance_.getOrbId() + " and server " + orbInstance_.getServerId() + System.identityHashCode(orbInstance_));
Assert._OB_assert(!destroy_);
Assert._OB_assert(starter_ != null);
starter_.setState(GIOPServerStarter.StateHolding);
}
//
// Dispatch any requests that arrive for the Server
//
public void activate() {
logger.fine("Activating GIOPServer " + System.identityHashCode(this) + " started for orb instance " + orbInstance_.getOrbId() + " and server " + orbInstance_.getServerId() + System.identityHashCode(orbInstance_));
Assert._OB_assert(!destroy_);
Assert._OB_assert(starter_ != null);
starter_.setState(GIOPServerStarter.StateActive);
}
//
// returns the GIOPServerStarter interface
//
public GIOPServerStarter _OB_getGIOPServerStarter() {
return starter_;
}
}
| 6,330 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/MinorCodes.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.omg.CORBA.OMGVMCID;
import org.apache.yoko.ApacheVMCID;
public final class MinorCodes {
public final static int OMGVMCID = org.omg.CORBA.OMGVMCID.value;
public final static int OOCVMCID = org.apache.yoko.ApacheVMCID.value;
// ----------------------------------------------------------------------
// Minor error codes for INITIALIZE
// ----------------------------------------------------------------------
public final static int MinorORBDestroyed = 1 | OOCVMCID;
public static String describeInitialize(int minor) {
String result = null;
switch (minor) {
case MinorORBDestroyed:
result = "ORB already destroyed";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for NO_IMPLEMENT
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorMissingLocalValueImplementation = 1 | OMGVMCID;
public final static int MinorIncompatibleValueImplementationVersion = 2 | OMGVMCID;
public final static int MinorNotSupportedByLocalObject = 3 | OMGVMCID;
public final static int MinorDIINotSupportedByLocalObject = 4 | OMGVMCID;
public static String describeNoImplement(int minor) {
String result = null;
switch (minor) {
case MinorMissingLocalValueImplementation:
result = "missing local value implementation";
break;
case MinorIncompatibleValueImplementationVersion:
result = "incompatible value implementation version";
break;
case MinorNotSupportedByLocalObject:
result = "operation not supported by local object";
break;
case MinorDIINotSupportedByLocalObject:
result = "DII operation not supported by local object";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for OBJECT_NOT_EXIST
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorUnregisteredValue = 1 | OMGVMCID;
public final static int MinorCannotDispatch = 2 | OMGVMCID;
public static String describeObjectNotExist(int minor) {
String result = null;
switch (minor) {
case MinorUnregisteredValue:
result = "attempt to pass an unregistered value as an object "
+ "reference";
break;
case MinorCannotDispatch:
result = "unable to dispatch - servant or POA not found";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for BAD_PARAM
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorValueFactoryError = 1 | OMGVMCID;
public final static int MinorRepositoryIdExists = 2 | OMGVMCID;
public final static int MinorNameExists = 3 | OMGVMCID;
public final static int MinorInvalidContainer = 4 | OMGVMCID;
public final static int MinorNameClashInInheritedContext = 5 | OMGVMCID;
public final static int MinorBadAbstractInterfaceType = 6 | OMGVMCID;
public final static int MinorBadSchemeName = 7 | OMGVMCID;
public final static int MinorBadAddress = 8 | OMGVMCID;
public final static int MinorBadSchemeSpecificPart = 9 | OMGVMCID;
public final static int MinorOther = 10 | OMGVMCID;
public final static int MinorInvalidAbstractInterfaceInheritance = 11 | OMGVMCID;
public final static int MinorInvalidValueInheritance = 12 | OMGVMCID;
public final static int MinorIncompleteTypeCodeParameter = 13 | OMGVMCID;
public final static int MinorInvalidObjectId = 14 | OMGVMCID;
public final static int MinorInvalidName = 15 | OMGVMCID;
public final static int MinorInvalidId = 16 | OMGVMCID;
public final static int MinorInvalidMemberName = 17 | OMGVMCID;
public final static int MinorDuplicateLabel = 18 | OMGVMCID;
public final static int MinorIncompatibleLabelType = 19 | OMGVMCID;
public final static int MinorInvalidDiscriminatorType = 20 | OMGVMCID;
public final static int MinorNoExceptionInAny = 21 | OMGVMCID;
public final static int MinorUnlistedUserException = 22 | OMGVMCID;
public final static int MinorNoWcharCodeSet = 23 | OMGVMCID;
public final static int MinorServiceContextIdOutOfRange = 24 | OMGVMCID;
public final static int MinorEnumValueOutOfRange = 25 | OMGVMCID;
public final static int MinorInvalidServiceContextId = 26 | OMGVMCID;
public final static int MinorObjectIsNull = 27 | OMGVMCID;
public final static int MinorInvalidComponentId = 28 | OMGVMCID;
public final static int MinorInvalidProfileId = 29 | OMGVMCID;
public final static int MinorDuplicatePolicyType = 30 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorDuplicateDeclarator = 1 | OOCVMCID;
public final static int MinorInvalidValueModifier = 2 | OOCVMCID;
public final static int MinorDuplicateValueInit = 3 | OOCVMCID;
public final static int MinorAbstractValueInit = 4 | OOCVMCID;
public final static int MinorDuplicateBaseType = 5 | OOCVMCID;
public final static int MinorSingleThreadedOnly = 6 | OOCVMCID;
public final static int MinorNameRedefinitionInImmediateScope = 7 | OOCVMCID;
public final static int MinorInvalidValueBoxType = 8 | OOCVMCID;
public final static int MinorInvalidLocalInterfaceInheritance = 9 | OOCVMCID;
public final static int MinorConstantTypeMismatch = 10 | OOCVMCID;
public final static int MinorInvalidPattern = 11 | OOCVMCID;
public final static int MinorInvalidScope = 12 | OOCVMCID;
public final static int MinorInvalidContextID = 13 | OOCVMCID;
public final static int MinorIncompatibleObjectType = 14 | OOCVMCID;
public static String describeBadParam(int minor) {
String result = null;
switch (minor) {
case MinorValueFactoryError:
result = "failure to register, unregister or lookup value factory";
break;
case MinorRepositoryIdExists:
result = "repository id already exists";
break;
case MinorNameExists:
result = "name already exists";
break;
case MinorInvalidContainer:
result = "target is not a valid container";
break;
case MinorNameClashInInheritedContext:
result = "name clash in inherited context";
break;
case MinorBadAbstractInterfaceType:
result = "incorrect type for abstract interface";
break;
case MinorBadSchemeName:
result = "bad scheme name";
break;
case MinorBadAddress:
result = "bad address";
break;
case MinorBadSchemeSpecificPart:
result = "bad scheme specific part";
break;
case MinorOther:
result = "other";
break;
case MinorInvalidAbstractInterfaceInheritance:
result = "invalid abstract interface inheritance";
break;
case MinorInvalidValueInheritance:
result = "invalid valuetype inheritance";
break;
case MinorIncompleteTypeCodeParameter:
result = "incomplete TypeCode parameter";
break;
case MinorInvalidObjectId:
result = "invalid object id";
break;
case MinorInvalidName:
result = "invalid name in TypeCode operation";
break;
case MinorInvalidId:
result = "invalid repository id in TypeCode operation";
break;
case MinorInvalidMemberName:
result = "invalid member name in TypeCode operation";
break;
case MinorDuplicateLabel:
result = "duplicate union label value";
break;
case MinorIncompatibleLabelType:
result = "incompatible union label value";
break;
case MinorInvalidDiscriminatorType:
result = "invalid union discriminator type";
break;
case MinorNoExceptionInAny:
result = "exception does not contain an any";
break;
case MinorUnlistedUserException:
result = "unlisted user exception";
break;
case MinorNoWcharCodeSet:
result = "wchar transmission code set not in service context";
break;
case MinorServiceContextIdOutOfRange:
result = "service context is not in OMG-defined range";
break;
case MinorEnumValueOutOfRange:
result = "enum value out of range";
break;
case MinorInvalidServiceContextId:
result = "invalid service context ID";
break;
case MinorObjectIsNull:
result = "Object parameter to register_initial_reference is null";
break;
case MinorInvalidComponentId:
result = "invalid component ID";
break;
case MinorInvalidProfileId:
result = "invalid profile ID";
break;
case MinorDuplicatePolicyType:
result = "duplicate policy types";
break;
case MinorDuplicateDeclarator:
result = "duplicate declarator";
break;
case MinorInvalidValueModifier:
result = "invalid valuetype modifier";
break;
case MinorDuplicateValueInit:
result = "duplicate valuetype initializer";
break;
case MinorAbstractValueInit:
result = "abstract valuetype cannot have initializers";
break;
case MinorDuplicateBaseType:
result = "base type appears more than once";
break;
case MinorSingleThreadedOnly:
result = "ORB doesn't support multiple threads";
break;
case MinorNameRedefinitionInImmediateScope:
result = "invalid name redefinition in an immediate scope";
break;
case MinorInvalidValueBoxType:
result = "invalid type for valuebox";
break;
case MinorInvalidLocalInterfaceInheritance:
result = "invalid local interface inheritance";
break;
case MinorConstantTypeMismatch:
result = "constant type doesn't match definition";
break;
case MinorInvalidPattern:
result = "invalid pattern";
break;
case MinorInvalidScope:
result = "invalid scope";
break;
case MinorInvalidContextID:
result = "invalid context ID";
break;
case MinorIncompatibleObjectType:
result = "incompatible object type";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for BAD_INV_ORDER
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorDependencyPreventsDestruction = 1 | OMGVMCID;
public final static int MinorIndestructibleObject = 2 | OMGVMCID;
public final static int MinorDestroyWouldBlock = 3 | OMGVMCID;
public final static int MinorShutdownCalled = 4 | OMGVMCID;
public final static int MinorDuplicateSend = 5 | OMGVMCID;
public final static int MinorServantManagerAlreadySet = 6 | OMGVMCID;
public final static int MinorInvalidUseOfDSIArguments = 7 | OMGVMCID;
public final static int MinorInvalidUseOfDSIContext = 8 | OMGVMCID;
public final static int MinorInvalidUseOfDSIResult = 9 | OMGVMCID;
public final static int MinorRequestAlreadySent = 10 | OMGVMCID;
public final static int MinorRequestNotSent = 11 | OMGVMCID;
public final static int MinorResponseAlreadyReceived = 12 | OMGVMCID;
public final static int MinorSynchronousRequest = 13 | OMGVMCID;
public final static int MinorInvalidPICall = 14 | OMGVMCID;
public final static int MinorServiceContextExists = 15 | OMGVMCID;
public final static int MinorPolicyFactoryExists = 16 | OMGVMCID;
public final static int MinorNoCreatePOA = 17 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorBadConcModel = 1 | OOCVMCID;
public final static int MinorORBRunning = 2 | OOCVMCID;
public static String describeBadInvOrder(int minor) {
String result = null;
switch (minor) {
case MinorDependencyPreventsDestruction:
result = "dependency prevents destruction of object";
break;
case MinorIndestructibleObject:
result = "destroy invoked on indestructible object";
break;
case MinorDestroyWouldBlock:
result = "operation would deadlock";
break;
case MinorShutdownCalled:
result = "ORB has shutdown";
break;
case MinorDuplicateSend:
result = "request has already been sent";
break;
case MinorServantManagerAlreadySet:
result = "servant manager already set";
break;
case MinorInvalidUseOfDSIArguments:
result = "invalid use of DSI arguments";
break;
case MinorInvalidUseOfDSIContext:
result = "invalid use of DSI context";
break;
case MinorInvalidUseOfDSIResult:
result = "invalid use of DSI result";
break;
case MinorRequestAlreadySent:
result = "DII request has already been sent";
break;
case MinorRequestNotSent:
result = "DII request has not been sent yet";
break;
case MinorResponseAlreadyReceived:
result = "DII response has already been received";
break;
case MinorSynchronousRequest:
result = "operation not supported on synchronous DII request";
break;
case MinorInvalidPICall:
result = "invalid Portable Interceptor call";
break;
case MinorServiceContextExists:
result = "a service context already exists with the given ID";
break;
case MinorPolicyFactoryExists:
result = "a factory already exists for that PolicyType";
break;
case MinorNoCreatePOA:
result = "cannot create POA while undergoing destruction";
break;
case MinorBadConcModel:
result = "invalid concurrency model";
break;
case MinorORBRunning:
result = "ORB::run already called";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for COMM_FAILURE
// ----------------------------------------------------------------------
//
// Standard minor codes
//
/* None yet */
//
// Yoko specific minor codes
//
public final static int MinorRecv = 1 | OOCVMCID;
public final static int MinorSend = 2 | OOCVMCID;
public final static int MinorRecvZero = 3 | OOCVMCID;
public final static int MinorSendZero = 4 | OOCVMCID;
public final static int MinorSocket = 5 | OOCVMCID;
public final static int MinorSetsockopt = 6 | OOCVMCID;
public final static int MinorGetsockopt = 7 | OOCVMCID;
public final static int MinorBind = 8 | OOCVMCID;
public final static int MinorListen = 9 | OOCVMCID;
public final static int MinorConnect = 10 | OOCVMCID;
public final static int MinorAccept = 11 | OOCVMCID;
public final static int MinorSelect = 12 | OOCVMCID;
public final static int MinorSetSoTimeout = 26 | OOCVMCID;
public final static int MinorGetsockname = 27 | OOCVMCID;
public final static int MinorGetpeername = 28 | OOCVMCID;
public final static int MinorGethostname = 13 | OOCVMCID;
public final static int MinorGethostbyname = 14 | OOCVMCID;
public final static int MinorWSAStartup = 15 | OOCVMCID;
public final static int MinorWSACleanup = 16 | OOCVMCID;
public final static int MinorNoGIOP = 17 | OOCVMCID;
public final static int MinorUnknownMessage = 18 | OOCVMCID;
public final static int MinorWrongMessage = 19 | OOCVMCID;
public final static int MinorMessageError = 21 | OOCVMCID;
public final static int MinorFragment = 22 | OOCVMCID;
public final static int MinorUnknownReqId = 24 | OOCVMCID;
public final static int MinorVersion = 25 | OOCVMCID;
public final static int MinorPipe = 23 | OOCVMCID;
public final static int MinorUnknownReplyMessage = 29 | OOCVMCID;
//
// Yoko deprecated minor codes
//
public final static int MinorDeprecatedCloseConnection = 20 | OOCVMCID;
public static String describeCommFailure(int minor) {
String result = null;
switch (minor) {
case MinorRecv:
result = "recv() failed";
break;
case MinorSend:
result = "send() failed";
break;
case MinorRecvZero:
result = "recv() returned zero";
break;
case MinorSendZero:
result = "send() returned zero";
break;
case MinorSocket:
result = "socket() failed";
break;
case MinorSetsockopt:
result = "setsockopt() failed";
break;
case MinorGetsockopt:
result = "getsockopt() failed";
break;
case MinorBind:
result = "bind() failed";
break;
case MinorListen:
result = "listen() failed";
break;
case MinorConnect:
result = "connect() failed";
break;
case MinorAccept:
result = "accept() failed";
break;
case MinorSelect:
result = "select() failed";
break;
case MinorSetSoTimeout:
result = "setSoTimeout() failed";
break;
case MinorGethostname:
result = "gethostname() failed";
break;
case MinorGethostbyname:
result = "gethostbyname() failed";
break;
case MinorWSAStartup:
result = "WSAStartup() failed";
break;
case MinorWSACleanup:
result = "WSACleanup() failed";
break;
case MinorNoGIOP:
result = "not a GIOP message";
break;
case MinorUnknownMessage:
result = "unknown GIOP message";
break;
case MinorWrongMessage:
result = "wrong GIOP message";
break;
case MinorMessageError:
result = "got a `MessageError' message";
break;
case MinorFragment:
result = "invalid fragment message";
break;
case MinorUnknownReqId:
result = "unknown request id";
break;
case MinorVersion:
result = "unsupported GIOP version";
break;
case MinorPipe:
result = "pipe() failed";
break;
case MinorUnknownReplyMessage:
result = "unknown GIOP message in reply";
break;
case MinorDeprecatedCloseConnection:
result = "got a `CloseConnection' message";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for INTF_REPOS
// ----------------------------------------------------------------------
//
// Standard minor codes
//
/* None yet */
//
// Yoko specific minor codes
//
public final static int MinorNoIntfRepos = 1 | OOCVMCID;
public final static int MinorLookupAmbiguous = 2 | OOCVMCID;
public final static int MinorIllegalRecursion = 3 | OOCVMCID;
public final static int MinorNoEntry = 4 | OOCVMCID;
public static String describeIntfRepos(int minor) {
String result = null;
switch (minor) {
case MinorNoIntfRepos:
result = "interface repository is not available";
break;
case MinorLookupAmbiguous:
result = "search name for lookup() is ambiguous";
break;
case MinorIllegalRecursion:
result = "illegal recursion";
break;
case MinorNoEntry:
result = "repository ID not found";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for MARSHAL
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorNoValueFactory = 1 | OMGVMCID;
public final static int MinorDSIResultBeforeContext = 2 | OMGVMCID;
public final static int MinorDSIInvalidParameterList = 3 | OMGVMCID;
public final static int MinorLocalObject = 4 | OMGVMCID;
public final static int MinorWcharSentByClient = 5 | OMGVMCID;
public final static int MinorWcharSentByServer = 6 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorReadOverflow = 1 | OOCVMCID;
public final static int MinorReadBooleanOverflow = 2 | OOCVMCID;
public final static int MinorReadCharOverflow = 3 | OOCVMCID;
public final static int MinorReadWCharOverflow = 4 | OOCVMCID;
public final static int MinorReadOctetOverflow = 5 | OOCVMCID;
public final static int MinorReadShortOverflow = 6 | OOCVMCID;
public final static int MinorReadUShortOverflow = 7 | OOCVMCID;
public final static int MinorReadLongOverflow = 8 | OOCVMCID;
public final static int MinorReadULongOverflow = 9 | OOCVMCID;
public final static int MinorReadLongLongOverflow = 10 | OOCVMCID;
public final static int MinorReadULongLongOverflow = 11 | OOCVMCID;
public final static int MinorReadFloatOverflow = 12 | OOCVMCID;
public final static int MinorReadDoubleOverflow = 13 | OOCVMCID;
public final static int MinorReadLongDoubleOverflow = 14 | OOCVMCID;
public final static int MinorReadStringOverflow = 15 | OOCVMCID;
public final static int MinorReadStringZeroLength = 16 | OOCVMCID;
public final static int MinorReadStringNullChar = 17 | OOCVMCID;
public final static int MinorReadStringNoTerminator = 18 | OOCVMCID;
public final static int MinorReadWStringOverflow = 19 | OOCVMCID;
public final static int MinorReadWStringZeroLength = 20 | OOCVMCID;
public final static int MinorReadWStringNullWChar = 21 | OOCVMCID;
public final static int MinorReadWStringNoTerminator = 22 | OOCVMCID;
public final static int MinorReadFixedOverflow = 23 | OOCVMCID;
public final static int MinorReadFixedInvalid = 24 | OOCVMCID;
public final static int MinorReadBooleanArrayOverflow = 25 | OOCVMCID;
public final static int MinorReadCharArrayOverflow = 26 | OOCVMCID;
public final static int MinorReadWCharArrayOverflow = 27 | OOCVMCID;
public final static int MinorReadOctetArrayOverflow = 28 | OOCVMCID;
public final static int MinorReadShortArrayOverflow = 29 | OOCVMCID;
public final static int MinorReadUShortArrayOverflow = 30 | OOCVMCID;
public final static int MinorReadLongArrayOverflow = 31 | OOCVMCID;
public final static int MinorReadULongArrayOverflow = 32 | OOCVMCID;
public final static int MinorReadLongLongArrayOverflow = 33 | OOCVMCID;
public final static int MinorReadULongLongArrayOverflow = 34 | OOCVMCID;
public final static int MinorReadFloatArrayOverflow = 35 | OOCVMCID;
public final static int MinorReadDoubleArrayOverflow = 36 | OOCVMCID;
public final static int MinorReadLongDoubleArrayOverflow = 37 | OOCVMCID;
public final static int MinorReadInvTypeCodeIndirection = 38 | OOCVMCID;
public final static int MinorLongDoubleNotSupported = 40 | OOCVMCID;
public final static int MinorNativeNotSupported = 41 | OOCVMCID;
public final static int MinorReadInvalidIndirection = 42 | OOCVMCID;
public final static int MinorReadIDMismatch = 43 | OOCVMCID;
public final static int MinorReadUnsupported = 44 | OOCVMCID;
public final static int MinorWriteUnsupported = 45 | OOCVMCID;
public final static int MinorLoadStub = 46 | OOCVMCID;
//
// Yoko deprecated minor codes
//
public final static int MinorDeprecatedWriteObjectLocal = 39 | OOCVMCID;
public static String describeMarshal(int minor) {
String result = null;
switch (minor) {
case MinorNoValueFactory:
result = "no valuetype factory";
break;
case MinorDSIResultBeforeContext:
result = "DSI result cannot be set before context";
break;
case MinorDSIInvalidParameterList:
result = "DSI argument list does not describe all parameters";
break;
case MinorLocalObject:
result = "attempt to marshal local object";
break;
case MinorWcharSentByClient:
result = "wchar data sent by client on GIOP 1.0 connection";
break;
case MinorWcharSentByServer:
result = "wchar data returned by server on GIOP 1.0 connection";
break;
case MinorReadOverflow:
result = "input stream buffer overflow";
break;
case MinorReadBooleanOverflow:
result = "overflow while reading boolean";
break;
case MinorReadCharOverflow:
result = "overflow while reading char";
break;
case MinorReadWCharOverflow:
result = "overflow while reading wchar";
break;
case MinorReadOctetOverflow:
result = "overflow while reading octet";
break;
case MinorReadShortOverflow:
result = "overflow while reading short";
break;
case MinorReadUShortOverflow:
result = "overflow while reading ushort";
break;
case MinorReadLongOverflow:
result = "overflow while reading long";
break;
case MinorReadULongOverflow:
result = "overflow while reading ulong";
break;
case MinorReadLongLongOverflow:
result = "overflow while reading longlong";
break;
case MinorReadULongLongOverflow:
result = "overflow while reading ulonglong";
break;
case MinorReadFloatOverflow:
result = "overflow while reading float";
break;
case MinorReadDoubleOverflow:
result = "overflow while reading double";
break;
case MinorReadLongDoubleOverflow:
result = "overflow while reading longdouble";
break;
case MinorReadStringOverflow:
result = "overflow while reading string";
break;
case MinorReadStringZeroLength:
result = "encountered zero-length string";
break;
case MinorReadStringNullChar:
result = "encountered null char in string";
break;
case MinorReadStringNoTerminator:
result = "terminating null char missing in string";
break;
case MinorReadWStringOverflow:
result = "overflow while reading wstring";
break;
case MinorReadWStringZeroLength:
result = "encountered zero-length wstring";
break;
case MinorReadWStringNullWChar:
result = "encountered null wchar in wstring";
break;
case MinorReadWStringNoTerminator:
result = "terminating null wchar missing in wstring";
break;
case MinorReadFixedOverflow:
result = "overflow while reading fixed";
break;
case MinorReadFixedInvalid:
result = "invalid encoding for fixed value";
break;
case MinorReadBooleanArrayOverflow:
result = "overflow while reading boolean array";
break;
case MinorReadCharArrayOverflow:
result = "overflow while reading char array";
break;
case MinorReadWCharArrayOverflow:
result = "overflow while reading wchar array";
break;
case MinorReadOctetArrayOverflow:
result = "overflow while reading octet array";
break;
case MinorReadShortArrayOverflow:
result = "overflow while reading short array";
break;
case MinorReadUShortArrayOverflow:
result = "overflow while reading ushort array";
break;
case MinorReadLongArrayOverflow:
result = "overflow while reading long array";
break;
case MinorReadULongArrayOverflow:
result = "overflow while reading ulong array";
break;
case MinorReadLongLongArrayOverflow:
result = "overflow while reading longlong array";
break;
case MinorReadULongLongArrayOverflow:
result = "overflow while reading ulonglong array";
break;
case MinorReadFloatArrayOverflow:
result = "overflow while reading float array";
break;
case MinorReadDoubleArrayOverflow:
result = "overflow while reading double array";
break;
case MinorReadLongDoubleArrayOverflow:
result = "overflow while reading longdouble array";
break;
case MinorReadInvTypeCodeIndirection:
result = "invalid TypeCode indirection";
break;
case MinorLongDoubleNotSupported:
result = "long double is not supported";
break;
case MinorNativeNotSupported:
result = "long double is not supported";
break;
case MinorDeprecatedWriteObjectLocal:
result = "attempt to marshal a locality-constrained object";
break;
case MinorReadInvalidIndirection:
result = "invalid indirection location";
break;
case MinorReadIDMismatch:
result = "type ID mismatch";
break;
case MinorReadUnsupported:
result = "reading unsupported type";
break;
case MinorWriteUnsupported:
result = "writing unsupported type";
break;
case MinorLoadStub:
result = "error loading stub class";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for IMP_LIMIT
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorNoUsableProfile = 1 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorMessageSizeLimit = 1 | OOCVMCID;
public final static int MinorThreadLimit = 2 | OOCVMCID;
public static String describeImpLimit(int minor) {
String result = null;
switch (minor) {
case MinorNoUsableProfile:
result = "no usable profile in IOR";
break;
case MinorMessageSizeLimit:
result = "maximum message size exceeded";
break;
case MinorThreadLimit:
result = "can't create new thread";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for NO_MEMORY
// ----------------------------------------------------------------------
//
// Standard minor codes
//
/* None yet */
//
// Yoko specific minor codes
//
public final static int MinorAllocationFailure = 1 | OOCVMCID;
public static String describeNoMemory(int minor) {
String result = null;
switch (minor) {
case MinorAllocationFailure:
result = "memory allocation failure";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for TRANSIENT
// ----------------------------------------------------------------------
//
// PortableInterceptor minor codes
//
public final static int MinorRequestDiscarded = 1 | OMGVMCID;
public final static int MinorNoUsableProfileInIOR = 2 | OMGVMCID;
public final static int MinorRequestCancelled = 3 | OMGVMCID;
public final static int MinorPOADestroyed = 4 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorConnectFailed = 1 | OOCVMCID;
public final static int MinorCloseConnection = 2 | OOCVMCID;
public final static int MinorActiveConnectionManagement = 3 | OOCVMCID;
public final static int MinorForcedShutdown = 4 | OOCVMCID;
public final static int MinorLocationForwardHopCountExceeded = 5 | OOCVMCID;
public static String describeTransient(int minor) {
String result = null;
switch (minor) {
case MinorRequestDiscarded:
result = "request has been discarded";
break;
case MinorNoUsableProfileInIOR:
result = "no usable profile in IOR";
break;
case MinorRequestCancelled:
result = "request has been cancelled";
break;
case MinorPOADestroyed:
result = "POA has been destroyed";
break;
case MinorConnectFailed:
result = "attempt to establish connection failed";
break;
case MinorCloseConnection:
result = "got a `CloseConnection' message";
break;
case MinorActiveConnectionManagement:
result = "active connection management closed connection";
break;
case MinorForcedShutdown:
result = "forced connection shutdown because of timeout";
break;
case MinorLocationForwardHopCountExceeded:
result = "maximum forwarding count (10) exceeded";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for NO_RESOURCES
// ----------------------------------------------------------------------
//
// PortableInterceptor minor codes
//
public final static int MinorInvalidBinding = 1 | OMGVMCID;
public static String describeNoResources(int minor) {
String result = null;
switch (minor) {
case MinorInvalidBinding:
result = "Portable Interceptor operation not supported in "
+ "binding";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for UNKNOWN
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorUnknownUserException = 1 | OMGVMCID;
public final static int MinorSystemExceptionNotSupported = 2 | OMGVMCID;
public static String describeUnknown(int minor) {
String result = null;
switch (minor) {
case MinorUnknownUserException:
result = "an unknown user exception was raised";
break;
case MinorSystemExceptionNotSupported:
result = "an unsupported system exception was raised";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for INV_POLICY
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorCannotReconcilePolicy = 1 | OMGVMCID;
public final static int MinorInvalidPolicyType = 2 | OMGVMCID;
public final static int MinorNoPolicyFactory = 3 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorNoPolicy = 1 | OOCVMCID;
public static String describeInvPolicy(int minor) {
String result = null;
switch (minor) {
case MinorCannotReconcilePolicy:
result = "cannot reconcile IOR policy with effective policy "
+ "override";
break;
case MinorInvalidPolicyType:
result = "invalid PolicyType";
break;
case MinorNoPolicyFactory:
result = "no PolicyFactory for the PolicyType has been registered";
break;
case MinorNoPolicy:
result = "no policy for the PolicyType is available";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for INV_OBJREF
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorNoWcharSupport = 1 | OMGVMCID;
public final static int MinorWcharCodeSetRequired = 2 | OMGVMCID;
public static String describeInvObjref(int minor) {
String result = null;
switch (minor) {
case MinorNoWcharSupport:
result = "wchar code set support not specified";
break;
case MinorWcharCodeSetRequired:
result = "code set component required for wchar/wstring";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for BAD_TYPECODE
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorIncompleteTypeCode = 1 | OMGVMCID;
public final static int MinorInvalidMemberType = 2 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorInvalidUnionDiscriminator = 1 | OOCVMCID;
public final static int MinorInvalidPropertyType = 2 | OOCVMCID;
public static String describeBadTypecode(int minor) {
String result = null;
switch (minor) {
case MinorIncompleteTypeCode:
result = "attempt to marshal incomplete TypeCode";
break;
case MinorInvalidMemberType:
result = "invalid member type in TypeCode operation";
break;
case MinorInvalidUnionDiscriminator:
result = "invalid union discriminator type";
break;
case MinorInvalidPropertyType:
result = "property value does not contain a string";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for OBJ_ADAPTER
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorSystemExceptionInUnknownAdapter = 1 | OMGVMCID;
public final static int MinorServantNotFound = 2 | OMGVMCID;
public final static int MinorNoDefaultServant = 3 | OMGVMCID;
public final static int MinorNoServantManager = 4 | OMGVMCID;
public final static int MinorIncarnateViolatedPOAPolicy = 5 | OMGVMCID;
public static String describeObjAdapter(int minor) {
String result = null;
switch (minor) {
case MinorSystemExceptionInUnknownAdapter:
result = "unknown_adapter raised a system exception";
break;
case MinorServantNotFound:
result = "servant not found";
break;
case MinorNoDefaultServant:
result = "no default servant available";
break;
case MinorNoServantManager:
result = "no servant manager available";
break;
case MinorIncarnateViolatedPOAPolicy:
result = "incarnate violated a POA policy";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for DATA_CONVERSION
// ----------------------------------------------------------------------
//
// Standard minor codes
//
public final static int MinorNoCharacterMapping = 1 | OMGVMCID;
//
// Yoko specific minor codes
//
public final static int MinorNoAlias = 1 | OOCVMCID;
public final static int MinorUTF8Overflow = 2 | OOCVMCID;
public final static int MinorUTF8Encoding = 3 | OOCVMCID;
public static String describeDataConversion(int minor) {
String result = null;
switch (minor) {
case MinorNoCharacterMapping:
result = "character does not map to negotiated transmission "
+ "code set";
break;
case MinorNoAlias:
result = "alias types not supported";
break;
case MinorUTF8Overflow:
result = "UTF8 overflow";
break;
case MinorUTF8Encoding:
result = "invalid UTF8 character1";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for BAD_OPERATION
// ----------------------------------------------------------------------
//
// Standard minor codes
//
//
// Yoko specific minor codes
//
public final static int MinorTypeMismatch = 1 | OOCVMCID;
public final static int MinorNullValueNotAllowed = 2 | OOCVMCID;
public static String describeBadOperation(int minor) {
String result = null;
switch (minor) {
case MinorTypeMismatch:
result = "Type mismatch";
break;
case MinorNullValueNotAllowed:
result = "Null value not allowed";
break;
}
return result;
}
// ----------------------------------------------------------------------
// Minor error codes for BAD_CONTEXT
// ----------------------------------------------------------------------
//
// Standard minor codes
//
//
// Yoko specific minor codes
//
public final static int MinorNoPatternMatch = 1 | OOCVMCID;
public static String describeBadContext(int minor) {
String result = null;
switch (minor) {
case MinorNoPatternMatch:
result = "No match found";
break;
}
return result;
}
}
| 6,331 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocateRequestPolicyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocateRequestPolicy:1.0
//
final public class LocateRequestPolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, LocateRequestPolicy val)
{
any.insert_Object(val, type());
}
public static LocateRequestPolicy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "LocateRequestPolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/LocateRequestPolicy:1.0";
}
public static LocateRequestPolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, LocateRequestPolicy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static LocateRequestPolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (LocateRequestPolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,332 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PIManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class PIManager {
//
// The ORB (Java only)
//
private org.omg.CORBA.ORB orb_;
//
// The ORB Instance
//
private ORBInstance orbInstance_;
//
// The next interceptor id and mutex
//
private int id_;
private java.lang.Object idMut_ = new java.lang.Object();
//
// The PortableInterceptor::Current implementation
//
private org.apache.yoko.orb.PortableInterceptor.Current_impl current_;
//
// The registered ClientRequestInterceptors
//
private java.util.Vector clientReqInterceptors_ = new java.util.Vector();
//
// The registered ServerRequestInterceptors
//
private java.util.Vector serverReqInterceptors_ = new java.util.Vector();
//
// The registered IORInterceptors
//
private java.util.Vector iorInterceptors_ = new java.util.Vector();
//
// The number of state slots
//
private int maxSlots_;
//
// Have all ORB initializers been invoked?
//
private boolean complete_;
// ----------------------------------------------------------------------
// PIManager private member implementation
// ----------------------------------------------------------------------
private int nextID() {
synchronized (idMut_) {
return id_++;
}
}
// ----------------------------------------------------------------------
// PIManager public member implementation
// ----------------------------------------------------------------------
public PIManager(org.omg.CORBA.ORB orb) {
orb_ = orb;
id_ = 0;
current_ = null;
maxSlots_ = 0;
complete_ = false;
}
void destroy() {
java.util.Enumeration e;
e = clientReqInterceptors_.elements();
while (e.hasMoreElements()) {
org.omg.PortableInterceptor.Interceptor interceptor = (org.omg.PortableInterceptor.Interceptor) e
.nextElement();
try {
interceptor.destroy();
} catch (RuntimeException ex) {
// ignore
}
}
e = serverReqInterceptors_.elements();
while (e.hasMoreElements()) {
org.omg.PortableInterceptor.Interceptor interceptor = (org.omg.PortableInterceptor.Interceptor) e
.nextElement();
try {
interceptor.destroy();
} catch (RuntimeException ex) {
// ignore
}
}
e = iorInterceptors_.elements();
while (e.hasMoreElements()) {
org.omg.PortableInterceptor.Interceptor interceptor = (org.omg.PortableInterceptor.Interceptor) e
.nextElement();
try {
interceptor.destroy();
} catch (RuntimeException ex) {
// ignore
}
}
orbInstance_ = null;
}
public void addIORInterceptor(
org.omg.PortableInterceptor.IORInterceptor interceptor,
boolean insertAtHead)
throws org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName {
//
// Ensure that this interceptor isn't already registered. Ignore
// anonymous interceptors (that is interceptors with no name).
//
String name = interceptor.name();
if (name.length() != 0) {
java.util.Enumeration e = iorInterceptors_.elements();
while (e.hasMoreElements()) {
String curr = ((org.omg.PortableInterceptor.IORInterceptor) e
.nextElement()).name();
if (curr.length() == 0)
continue;
if (curr.equals(name))
throw new org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName(
name);
}
}
if (insertAtHead)
iorInterceptors_.insertElementAt(interceptor, 0);
else
iorInterceptors_.addElement(interceptor);
}
public void addClientRequestInterceptor(
org.omg.PortableInterceptor.ClientRequestInterceptor interceptor)
throws org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName {
//
// Ensure that this interceptor isn't already registered. Ignore
// anonymous interceptors (that is interceptors with no name).
//
String name = interceptor.name();
if (name.length() != 0) {
java.util.Enumeration e = clientReqInterceptors_.elements();
while (e.hasMoreElements()) {
String curr = ((org.omg.PortableInterceptor.ClientRequestInterceptor) e
.nextElement()).name();
if (curr.length() == 0)
continue;
if (curr.equals(name))
throw new org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName(
name);
}
}
clientReqInterceptors_.addElement(interceptor);
}
public void addServerRequestInterceptor(
org.omg.PortableInterceptor.ServerRequestInterceptor interceptor)
throws org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName {
//
// Ensure that this interceptor isn't already registered. Ignore
// anonymous interceptors (that is interceptors with no name).
//
String name = interceptor.name();
if (name.length() != 0) {
java.util.Enumeration e = serverReqInterceptors_.elements();
while (e.hasMoreElements()) {
String curr = ((org.omg.PortableInterceptor.ServerRequestInterceptor) e
.nextElement()).name();
if (curr.length() == 0)
continue;
if (curr.equals(name))
throw new org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName(
name);
}
}
serverReqInterceptors_.addElement(interceptor);
}
public int allocateSlotId() {
return maxSlots_++;
}
public void registerPolicyFactory(int type,
org.omg.PortableInterceptor.PolicyFactory factory) {
Assert._OB_assert(orbInstance_ != null);
orbInstance_.getPolicyFactoryManager().registerPolicyFactory(type,
factory, false);
}
public void setORBInstance(ORBInstance orbInstance) {
orbInstance_ = orbInstance;
//
// Allocate the PICurrent object
//
Assert._OB_assert(current_ == null);
current_ = new org.apache.yoko.orb.PortableInterceptor.Current_impl(
orb_);
//
// Register the initial reference
//
InitialServiceManager ism = orbInstance_.getInitialServiceManager();
try {
ism.addInitialReference("PICurrent", current_);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
Assert._OB_assert(ex);
}
}
public void setupComplete() {
//
// Set the number of available slots
//
current_._OB_setMaxSlots(maxSlots_);
//
// Add the default value of the interceptor policy to the ORB
// policy manager to false if there are no client request
// interceptors. It's not necessary to set this if there are
// client request interceptors since the default value is true.
//
if (clientReqInterceptors_.isEmpty()) {
InitialServiceManager ism = orbInstance_.getInitialServiceManager();
try {
org.omg.CORBA.PolicyManager pm = org.omg.CORBA.PolicyManagerHelper
.narrow(ism
.resolveInitialReferences("ORBPolicyManager"));
org.omg.CORBA.Policy[] pl = new org.omg.CORBA.Policy[1];
pl[0] = new InterceptorPolicy_impl(false);
pm.set_policy_overrides(pl,
org.omg.CORBA.SetOverrideType.ADD_OVERRIDE);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
Assert._OB_assert(ex);
} catch (org.omg.CORBA.InvalidPolicies ex) {
Assert._OB_assert(ex);
}
}
complete_ = true;
}
//
// No argument information available
//
org.omg.PortableInterceptor.ClientRequestInfo clientSendRequest(String op,
boolean responseExpected, org.omg.IOP.IOR IOR,
org.omg.IOP.IOR origIOR,
org.apache.yoko.orb.OCI.ProfileInfo profileInfo,
org.omg.CORBA.Policy[] policies, java.util.Vector requestSCL,
java.util.Vector replySCL) throws LocationForward {
Assert._OB_assert(current_ != null);
org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl info = new org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl(
orb_, nextID(), op, responseExpected, IOR, origIOR,
profileInfo, policies, requestSCL, replySCL, orbInstance_,
current_);
info._OB_request(clientReqInterceptors_);
return info;
}
//
// DII style
//
org.omg.PortableInterceptor.ClientRequestInfo clientSendRequest(String op,
boolean responseExpected, org.omg.IOP.IOR IOR,
org.omg.IOP.IOR origIOR,
org.apache.yoko.orb.OCI.ProfileInfo profileInfo,
org.omg.CORBA.Policy[] policies, java.util.Vector requestSCL,
java.util.Vector replySCL, org.omg.CORBA.NVList args,
org.omg.CORBA.NamedValue result,
org.omg.CORBA.ExceptionList exceptions) throws LocationForward {
Assert._OB_assert(current_ != null);
org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl info = new org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl(
orb_, nextID(), op, responseExpected, IOR, origIOR,
profileInfo, policies, requestSCL, replySCL, orbInstance_,
current_, args, result, exceptions);
info._OB_request(clientReqInterceptors_);
return info;
}
//
// SII style
//
org.omg.PortableInterceptor.ClientRequestInfo clientSendRequest(String op,
boolean responseExpected, org.omg.IOP.IOR IOR,
org.omg.IOP.IOR origIOR,
org.apache.yoko.orb.OCI.ProfileInfo profileInfo,
org.omg.CORBA.Policy[] policies, java.util.Vector requestSCL,
java.util.Vector replySCL, ParameterDesc argDesc[],
ParameterDesc retDesc, org.omg.CORBA.TypeCode[] exceptionTC)
throws LocationForward {
Assert._OB_assert(current_ != null);
org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl info = new org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl(
orb_, nextID(), op, responseExpected, IOR, origIOR,
profileInfo, policies, requestSCL, replySCL, orbInstance_,
current_, argDesc, retDesc, exceptionTC);
info._OB_request(clientReqInterceptors_);
return info;
}
void clientReceiveReply(org.omg.PortableInterceptor.ClientRequestInfo info)
throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl) info;
impl._OB_setReplyStatus(org.omg.PortableInterceptor.SUCCESSFUL.value);
impl._OB_reply();
}
void clientReceiveException(
org.omg.PortableInterceptor.ClientRequestInfo info,
boolean wasSystem, Exception ex, String exId)
throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl) info;
impl
._OB_setReplyStatus(wasSystem ? org.omg.PortableInterceptor.SYSTEM_EXCEPTION.value
: org.omg.PortableInterceptor.USER_EXCEPTION.value);
impl._OB_setReceivedException(ex, exId);
impl._OB_reply();
}
void clientReceiveLocationForward(
org.omg.PortableInterceptor.ClientRequestInfo info,
org.omg.IOP.IOR ior) throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ClientRequestInfo_impl) info;
impl
._OB_setReplyStatus(org.omg.PortableInterceptor.LOCATION_FORWARD.value);
impl._OB_setForwardReference(ior);
impl._OB_reply();
}
org.omg.PortableInterceptor.ServerRequestInfo serverCreateRequestInfo(
String op,
boolean responseExpected,
org.omg.CORBA.Policy[] policies,
byte[] adapterId,
byte[] objectId,
org.omg.PortableInterceptor.ObjectReferenceTemplate adapterTemplate,
java.util.Vector in, java.util.Vector out, org.apache.yoko.orb.OCI.TransportInfo transportInfo) throws LocationForward {
Assert._OB_assert(current_ != null);
return new org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl(
orb_, nextID(), op, responseExpected, policies, adapterId,
objectId, adapterTemplate, in, out, orbInstance_, current_, transportInfo);
}
//
// Setup the servant and POA information
//
void serverSetupServant(org.omg.PortableInterceptor.ServerRequestInfo info,
org.omg.PortableServer.Servant servant,
org.omg.PortableServer.POA poa) {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_servant(servant, poa);
}
//
// Notify the ServerRequestInfo about a context switch
//
void serverContextSwitch(org.omg.PortableInterceptor.ServerRequestInfo info) {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_contextSwitch();
}
//
// Set the parameter information (SSI case)
//
void serverParameterDesc(
org.omg.PortableInterceptor.ServerRequestInfo info,
ParameterDesc[] argDesc, ParameterDesc retDesc,
org.omg.CORBA.TypeCode[] exceptionTC) {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_parameterDesc(argDesc, retDesc, exceptionTC);
}
//
// Set the arguments (DSI case)
//
void serverArguments(org.omg.PortableInterceptor.ServerRequestInfo info,
org.omg.CORBA.NVList args) {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_arguments(args);
}
//
// Set the result (DSI case)
//
void serverResult(org.omg.PortableInterceptor.ServerRequestInfo info,
org.omg.CORBA.Any result) {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_result(result);
}
//
// Call the receive_request_service_contexts interception point
//
void serverReceiveRequestServiceContexts(
org.omg.PortableInterceptor.ServerRequestInfo info)
throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_requestServiceContext(serverReqInterceptors_);
}
//
// Call the receive_request interception point
//
void serverReceiveRequest(org.omg.PortableInterceptor.ServerRequestInfo info)
throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_request();
}
//
// Call the send_reply interception point
//
void serverSendReply(org.omg.PortableInterceptor.ServerRequestInfo info) {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl._OB_setReplyStatus(org.omg.PortableInterceptor.SUCCESSFUL.value);
impl._OB_sendReply();
}
//
// Call the send_location_forward interception point
//
void serverSendLocationForward(
org.omg.PortableInterceptor.ServerRequestInfo info,
org.omg.IOP.IOR ior) throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl
._OB_setReplyStatus(org.omg.PortableInterceptor.LOCATION_FORWARD.value);
impl._OB_setForwardReference(ior);
impl._OB_sendOther();
}
//
// Call the send_exception interception point
//
void serverSendException(
org.omg.PortableInterceptor.ServerRequestInfo info,
boolean wasSystem, Exception ex) throws LocationForward {
org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl impl = (org.apache.yoko.orb.PortableInterceptor.ServerRequestInfo_impl) info;
impl
._OB_setReplyStatus(wasSystem ? org.omg.PortableInterceptor.SYSTEM_EXCEPTION.value
: org.omg.PortableInterceptor.USER_EXCEPTION.value);
impl._OB_setReceivedException(ex, null);
impl._OB_sendException();
}
//
// For IORInterceptors
//
public void establishComponents(org.omg.PortableInterceptor.IORInfo info) {
java.util.Enumeration e = iorInterceptors_.elements();
while (e.hasMoreElements()) {
try {
((org.omg.PortableInterceptor.IORInterceptor) e.nextElement())
.establish_components(info);
} catch (org.omg.CORBA.SystemException ex) {
}
}
}
public void componentsEstablished(org.omg.PortableInterceptor.IORInfo info) {
java.util.Enumeration e = iorInterceptors_.elements();
while (e.hasMoreElements()) {
try {
org.omg.PortableInterceptor.IORInterceptor_3_0 ir = org.omg.PortableInterceptor.IORInterceptor_3_0Helper
.narrow((org.omg.CORBA.Object) e.nextElement());
if (ir != null) {
ir.components_established(info);
}
} catch (org.omg.CORBA.BAD_PARAM ex) {
}
}
}
public void adapterStateChange(
org.omg.PortableInterceptor.ObjectReferenceTemplate[] templates,
short state) {
java.util.Enumeration e = iorInterceptors_.elements();
while (e.hasMoreElements()) {
try {
org.omg.PortableInterceptor.IORInterceptor_3_0 ir = org.omg.PortableInterceptor.IORInterceptor_3_0Helper
.narrow((org.omg.CORBA.Object) e.nextElement());
if (ir != null) {
ir.adapter_state_changed(templates, state);
}
} catch (org.omg.CORBA.SystemException ex) {
}
}
}
public void adapterManagerStateChange(String id, short state) {
java.util.Enumeration e = iorInterceptors_.elements();
while (e.hasMoreElements()) {
try {
org.omg.PortableInterceptor.IORInterceptor_3_0 ir = org.omg.PortableInterceptor.IORInterceptor_3_0Helper
.narrow((org.omg.CORBA.Object) e.nextElement());
if (ir != null) {
ir.adapter_manager_state_changed(id, state);
}
} catch (org.omg.CORBA.SystemException ex) {
}
}
}
//
// Do we have client request interceptors?
//
public boolean haveClientInterceptors() {
return complete_ && !clientReqInterceptors_.isEmpty();
}
//
// Do we have server request interceptors?
//
public boolean haveServerInterceptors() {
return complete_ && !serverReqInterceptors_.isEmpty();
}
}
| 6,333 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/IORUtil.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.omg.CSIIOP.TransportAddress;
import org.omg.IOP.TaggedComponent;
public final class IORUtil {
public static void main(String...args) {
final byte[] ba = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f
};
System.out.println("----");
StringBuilder sb = new StringBuilder(200);
for (int i = 0; i < 0x10; i++) {
IORUtil.dump_octets(ba, i, 0x20, sb);
System.out.println(sb.toString());
System.out.println("----");
sb.setLength(0);
}
}
private static void describeCSISecMechList(org.omg.IOP.TaggedComponent component, StringBuilder sb) {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
org.omg.CSIIOP.CompoundSecMechList info = org.omg.CSIIOP.CompoundSecMechListHelper.read(in);
sb.append("CSI Security Mechanism List Components:\n");
sb.append(" stateful: " + info.stateful + "\n");
sb.append(" mechanism_list:\n");
for (org.omg.CSIIOP.CompoundSecMech mech: info.mechanism_list) {
sb.append(" target_requires: "); describeTransportFlags(mech.target_requires, sb); sb.append("\n");
if (mech.transport_mech != null) {
if (mech.transport_mech.tag == org.omg.CSIIOP.TAG_NULL_TAG.value) {
sb.append(" Null Transport\n");
} else if (mech.transport_mech.tag == org.omg.CSIIOP.TAG_TLS_SEC_TRANS.value) {
describeTLS_SEC_TRANS(mech.transport_mech, sb);
} else if (mech.transport_mech.tag == org.omg.CSIIOP.TAG_SECIOP_SEC_TRANS.value) {
describeSECIOP_SEC_TRANS(mech.transport_mech, sb);
}
}
if (mech.as_context_mech != null) {
sb.append(" as_context_mech:\n");
sb.append(" supports: "); describeTransportFlags(mech.as_context_mech.target_supports, sb); sb.append("\n");
sb.append(" requires: "); describeTransportFlags(mech.as_context_mech.target_requires, sb); sb.append("\n");
sb.append(" client_authentication_mech: "); format_octets(mech.as_context_mech.client_authentication_mech, sb); sb.append("\n");
sb.append(" target_name: "); format_octets(mech.as_context_mech.target_name, sb); sb.append("\n");
}
if (mech.sas_context_mech != null) {
sb.append(" sas_context_mech:\n");
sb.append(" supports: "); describeTransportFlags(mech.sas_context_mech.target_supports, sb); sb.append("\n");
sb.append(" requires: "); describeTransportFlags(mech.sas_context_mech.target_requires, sb); sb.append("\n");
sb.append(" privilege_authorities:\n");
for (org.omg.CSIIOP.ServiceConfiguration auth: mech.sas_context_mech.privilege_authorities) {
sb.append(" syntax: " + auth.syntax + "\n");
sb.append(" name: "); format_octets(auth.name, sb); sb.append("\n");
}
sb.append(" supported_naming_mechanisms:\n");
for (byte[] namingMech: mech.sas_context_mech.supported_naming_mechanisms) {
sb.append(" "); format_octets(namingMech, sb); sb.append("\n");
}
sb.append(" supported_identity_type: "); describeIdentityToken(mech.sas_context_mech.supported_identity_types, sb); sb.append("\n");
}
}
}
private static void describeTransportFlags(int flag, StringBuilder sb) {
if ((org.omg.CSIIOP.NoProtection.value & flag) != 0) {
sb.append("NoProtection ");
}
if ((org.omg.CSIIOP.Integrity.value & flag) != 0) {
sb.append("Integrity ");
}
if ((org.omg.CSIIOP.Confidentiality.value & flag) != 0) {
sb.append("Confidentiality ");
}
if ((org.omg.CSIIOP.DetectReplay.value & flag) != 0) {
sb.append("DetectReplay ");
}
if ((org.omg.CSIIOP.DetectMisordering.value & flag) != 0) {
sb.append("DetectMisordering ");
}
if ((org.omg.CSIIOP.EstablishTrustInTarget.value & flag) != 0) {
sb.append("EstablishTrustInTarget ");
}
if ((org.omg.CSIIOP.EstablishTrustInClient.value & flag) != 0) {
sb.append("EstablishTrustInClient ");
}
if ((org.omg.CSIIOP.NoDelegation.value & flag) != 0) {
sb.append("NoDelegation ");
}
if ((org.omg.CSIIOP.SimpleDelegation.value & flag) != 0) {
sb.append("SimpleDelegation ");
}
if ((org.omg.CSIIOP.CompositeDelegation.value & flag) != 0) {
sb.append("CompositeDelegation ");
}
if ((org.omg.CSIIOP.IdentityAssertion.value & flag) != 0) {
sb.append("IdentityAssertion ");
}
if ((org.omg.CSIIOP.DelegationByClient.value & flag) != 0) {
sb.append("DelegationByClient ");
}
}
private static void describeIdentityToken(int flag, StringBuilder sb) {
if (flag == org.omg.CSI.ITTAbsent.value) {
sb.append("Absent");
return;
}
if ((org.omg.CSI.ITTAnonymous.value & flag) != 0) {
sb.append("Anonymous ");
}
if ((org.omg.CSI.ITTPrincipalName.value & flag) != 0) {
sb.append("PrincipalName ");
}
if ((org.omg.CSI.ITTX509CertChain.value & flag) != 0) {
sb.append("X509CertChain ");
}
if ((org.omg.CSI.ITTDistinguishedName.value & flag) != 0) {
sb.append("DistinguishedName ");
}
}
private static void describeTLS_SEC_TRANS(org.omg.IOP.TaggedComponent component, StringBuilder sb) {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
org.omg.CSIIOP.TLS_SEC_TRANS info = org.omg.CSIIOP.TLS_SEC_TRANSHelper.read(in);
sb.append(" TLS_SEC_TRANS component:\n");
sb.append(" target_supports: "); describeTransportFlags(info.target_supports, sb); sb.append("\n");
sb.append(" target_requires: "); describeTransportFlags(info.target_requires, sb); sb.append("\n");
sb.append(" addresses:\n");
for (TransportAddress address: info.addresses) {
sb.append(" host_name: ").append(address.host_name).append("\n");
sb.append(" port: ").append(address.port).append("\n");
}
}
private static void describeSECIOP_SEC_TRANS(org.omg.IOP.TaggedComponent component, StringBuilder sb) {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
org.omg.CSIIOP.SECIOP_SEC_TRANS info = org.omg.CSIIOP.SECIOP_SEC_TRANSHelper.read(in);
sb.append(" SECIOP_SEC_TRANS component:\n");
sb.append(" target_supports: "); describeTransportFlags(info.target_supports, sb); sb.append("\n");
sb.append(" target_requires: "); describeTransportFlags(info.target_requires, sb); sb.append("\n");
sb.append(" mech_oid: "); format_octets(info.mech_oid, sb); sb.append("\n");
sb.append(" target_name: "); format_octets(info.target_name, sb); sb.append("\n");
sb.append(" addresses:\n");
for (TransportAddress address: info.addresses) {
sb.append(" host_name: ").append(address.host_name).append("\n");
sb.append(" port: ").append(address.port).append("\n");
}
}
private static void describeCodeSets(org.omg.IOP.TaggedComponent component, StringBuilder sb) {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
org.omg.CONV_FRAME.CodeSetComponentInfo info = org.omg.CONV_FRAME.CodeSetComponentInfoHelper
.read(in);
CodeSetDatabase db = CodeSetDatabase.instance();
CodeSetInfo charInfo;
//
// Print char codeset information
//
sb.append("Native char codeset: \n");
charInfo = db.getCodeSetInfo(info.ForCharData.native_code_set);
if (charInfo != null) {
sb.append(" \"");
sb.append(charInfo.description);
sb.append("\"\n");
} else if (info.ForCharData.native_code_set == 0)
sb.append(" [No codeset information]\n");
else {
sb.append(" [Unknown codeset id: ");
sb.append(info.ForCharData.native_code_set);
sb.append("]\n");
}
for (int i = 0; i < info.ForCharData.conversion_code_sets.length; i++) {
if (i == 0)
sb.append("Char conversion codesets:\n");
charInfo = db
.getCodeSetInfo(info.ForCharData.conversion_code_sets[i]);
if (charInfo != null) {
sb.append(" \"");
sb.append(charInfo.description);
sb.append("\"\n");
} else {
sb.append(" [Unknown codeset id: ");
sb.append(info.ForCharData.conversion_code_sets[i]);
sb.append("]\n");
}
}
//
// Print wchar codeset information
//
sb.append("Native wchar codeset: \n");
charInfo = db.getCodeSetInfo(info.ForWcharData.native_code_set);
if (charInfo != null) {
sb.append(" \"");
sb.append(charInfo.description);
sb.append("\"\n");
} else if (info.ForWcharData.native_code_set == 0)
sb.append(" [No codeset information]\n");
else {
sb.append(" [Unknown codeset id: ");
sb.append(info.ForWcharData.native_code_set);
sb.append("]\n");
}
for (int i = 0; i < info.ForWcharData.conversion_code_sets.length; i++) {
if (i == 0)
sb.append("Wchar conversion codesets:\n");
charInfo = db
.getCodeSetInfo(info.ForWcharData.conversion_code_sets[i]);
if (charInfo != null) {
sb.append(" \"");
sb.append(charInfo.description);
sb.append("\"\n");
} else {
sb.append(" [Unknown codeset id: ");
sb.append(info.ForWcharData.conversion_code_sets[i]);
sb.append("]\n");
}
}
}
private static void describeGenericComponent(
org.omg.IOP.TaggedComponent component, String name, StringBuilder sb) {
sb.append("Component: ");
sb.append(name);
sb.append('\n');
sb.append("Component data: (");
sb.append(component.component_data.length);
sb.append(")\n");
dump_octets(component.component_data, 0,
component.component_data.length, sb);
}
//
// Convert an octet buffer into human-friendly data dump
//
public static String dump_octets(byte[] oct) {
StringBuilder sb = new StringBuilder();
dump_octets(oct, 0, oct.length, sb);
return sb.toString();
}
public static void dump_octets(byte[] oct, StringBuilder sb) {
dump_octets(oct, 0, oct.length, sb);
}
private static final char[] HEX_DIGIT = "0123456789abcdef".toCharArray();
private static final int PRINTABLE_CHAR_LOW = 31;
private static final int PRINTABLE_CHAR_HIGH = 127;
//
// Convert an octet buffer into human-friendly data dump
//
public static void dump_octets(final byte[] oct, final int offset, final int count, final StringBuilder sb) {
if (count <= 0) {
return;
}
final StringBuilder ascii = new StringBuilder(18);
switch (offset%0x10) {
case 0:
break;
case 0xf: sb.append(" "); ascii.append(" ");
case 0xe: sb.append(" "); ascii.append(" ");
case 0xd: sb.append(" "); ascii.append(" ");
case 0xc: sb.append(" "); ascii.append(" ");
case 0xb: sb.append(" "); ascii.append(" ");
case 0xa: sb.append(" "); ascii.append(" ");
case 0x9: sb.append(" "); ascii.append(" ");
case 0x8: sb.append(" "); ascii.append(" ");
case 0x7: sb.append(" "); ascii.append(" ");
case 0x6: sb.append(" "); ascii.append(" ");
case 0x5: sb.append(" "); ascii.append(" ");
case 0x4: sb.append(" "); ascii.append(" ");
case 0x3: sb.append(" "); ascii.append(" ");
case 0x2: sb.append(" "); ascii.append(" ");
case 0x1: sb.append(" "); ascii.append(" ");
}
ascii.append(" \"");
for (int i = offset; i < (offset + count); i++) {
final int b = oct[i] & 0xff;
// build up the ascii string for the end of the line
ascii.append((PRINTABLE_CHAR_LOW < b && b < PRINTABLE_CHAR_HIGH)? (char)b : '.');
// print the high hex nybble
sb.append(HEX_DIGIT[b>>4]);
// and the low hex nybble
sb.append(HEX_DIGIT[b&0xf]);
if (i%0x4 == (0x4-1)) {
// space the columns on every 4-byte boundary
sb.append(' ');
if (i%0x10 == (0x10-1)) {
// write the ascii interpretation on the end of every line
sb.append(ascii).append("\"\n");
ascii.setLength(0);
ascii.append(" \"");
if (i%0x100 == (0x100-1)) {
// separating line every 0x100 bytes
// 00000000 00000000 00000000 00000000 "................"
sb.append("-----------------------------------\n");
}
}
}
}
switch ((offset+count)%0x10) {
case 0:
break;
case 0x1: sb.append(" ");
case 0x2: sb.append(" ");
case 0x3: sb.append(" ");
case 0x4: sb.append(" ");
case 0x5: sb.append(" ");
case 0x6: sb.append(" ");
case 0x7: sb.append(" ");
case 0x8: sb.append(" ");
case 0x9: sb.append(" ");
case 0xa: sb.append(" ");
case 0xb: sb.append(" ");
case 0xc: sb.append(" ");
case 0xd: sb.append(" ");
case 0xe: sb.append(" ");
case 0xf: sb.append(" ").append(ascii).append("\"\n");
}
}
//
// Convert an octet buffer into a single-line readable data dump.
//
public static void format_octets(byte[] oct, StringBuilder sb) {
format_octets(oct, 0, oct.length, sb);
}
//
// Convert an octet buffer into a single-line readable data dump.
//
public static void format_octets(byte[] oct, int offset, int count, StringBuilder sb) {
if (count <= 0) {
return;
}
sb.append('"');
for (int i = offset; i < offset + count; i++) {
int n = (int) oct[i] & 0xff;
if (n >= 32 && n <= 127) {
sb.append((char)n);
}
else {
sb.append('?');
}
}
sb.append('"');
}
//
// Produce a human-friendly description of an IOR tagged component
//
public static void describe_component(
org.omg.IOP.TaggedComponent component, StringBuilder sb) {
switch (component.tag) {
case org.omg.IOP.TAG_ORB_TYPE.value: {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
int id = in.read_ulong();
sb.append("Component: TAG_ORB_TYPE = ");
sb.append("0x");
sb.append(Integer.toHexString(id));
sb.append('\n');
break;
}
case org.omg.IOP.TAG_CODE_SETS.value:
describeCodeSets(component, sb);
break;
case org.omg.IOP.TAG_POLICIES.value:
describeGenericComponent(component, "TAG_POLICIES", sb);
break;
case org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS.value: {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
String host = in.read_string();
short port = in.read_ushort();
sb.append("Alternate IIOP address:\n");
sb.append(" host: ");
sb.append(host);
sb.append('\n');
sb.append(" port: ");
sb.append(port < 0 ? 0xffff + (int) port + 1 : port);
sb.append('\n');
break;
}
case org.omg.IOP.TAG_ASSOCIATION_OPTIONS.value:
describeGenericComponent(component,
"TAG_ASSOCIATION_OPTIONS", sb);
break;
case org.omg.IOP.TAG_SEC_NAME.value:
describeGenericComponent(component, "TAG_SEC_NAME", sb);
break;
case org.omg.IOP.TAG_SPKM_1_SEC_MECH.value:
describeGenericComponent(component, "TAG_SPKM_1_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_SPKM_2_SEC_MECH.value:
describeGenericComponent(component, "TAG_SPKM_2_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_KerberosV5_SEC_MECH.value:
describeGenericComponent(component,
"TAG_KerberosV5_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_CSI_ECMA_Secret_SEC_MECH.value:
describeGenericComponent(component,
"TAG_CSI_ECMA_Secret_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_CSI_ECMA_Hybrid_SEC_MECH.value:
describeGenericComponent(component,
"TAG_CSI_ECMA_Hybrid_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_CSI_SEC_MECH_LIST.value:
describeCSISecMechList(component, sb);
break;
case org.omg.IOP.TAG_OTS_POLICY.value:
describeGenericComponent(component,
"TAG_OTS_POLICY", sb);
break;
case org.omg.CosTSInteroperation.TAG_INV_POLICY.value:
describeGenericComponent(component,
"TAG_INV_POLICY", sb);
break;
case org.omg.CSIIOP.TAG_SECIOP_SEC_TRANS.value:
describeGenericComponent(component,
"TAG_SECIOP_SEC_TRANS", sb);
break;
case org.omg.CSIIOP.TAG_NULL_TAG.value:
describeGenericComponent(component,
"TAG_NULL_TAG", sb);
break;
case org.omg.CSIIOP.TAG_TLS_SEC_TRANS.value:
describeGenericComponent(component,
"TAG_TLS_SEC_TRANS", sb);
break;
case org.omg.IOP.TAG_SSL_SEC_TRANS.value:
describeGenericComponent(component, "TAG_SSL_SEC_TRANS", sb);
break;
case org.omg.IOP.TAG_CSI_ECMA_Public_SEC_MECH.value:
describeGenericComponent(component,
"TAG_CSI_ECMA_Public_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_GENERIC_SEC_MECH.value:
describeGenericComponent(component, "TAG_GENERIC_SEC_MECH", sb);
break;
case org.omg.IOP.TAG_JAVA_CODEBASE.value: {
byte[] coct = component.component_data;
int len = component.component_data.length;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
coct, len);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf, 0, false);
in._OB_readEndian();
String codebase = in.read_string();
sb.append("Component: TAG_JAVA_CODEBASE = `");
sb.append(codebase);
sb.append("'\n");
break;
}
case org.omg.IOP.TAG_COMPLETE_OBJECT_KEY.value:
describeGenericComponent(component,
"TAG_COMPLETE_OBJECT_KEY", sb);
break;
case org.omg.IOP.TAG_ENDPOINT_ID_POSITION.value:
describeGenericComponent(component,
"TAG_ENDPOINT_ID_POSITION", sb);
break;
case org.omg.IOP.TAG_LOCATION_POLICY.value:
describeGenericComponent(component, "TAG_LOCATION_POLICY", sb);
break;
case org.omg.IOP.TAG_DCE_STRING_BINDING.value:
describeGenericComponent(component,
"TAG_DCE_STRING_BINDING", sb);
break;
case org.omg.IOP.TAG_DCE_BINDING_NAME.value:
describeGenericComponent(component, "TAG_DCE_BINDING_NAME", sb);
break;
case org.omg.IOP.TAG_DCE_NO_PIPES.value:
describeGenericComponent(component, "TAG_DCE_NO_PIPES", sb);
break;
case org.omg.IOP.TAG_DCE_SEC_MECH.value:
describeGenericComponent(component, "TAG_DCE_SEC_MECH", sb);
break;
default: {
String name = "unknown (tag = ";
name += component.tag;
name += ")";
describeGenericComponent(component, name, sb);
break;
}
}
}
}
| 6,334 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RequestTimeoutPolicy.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/RequestTimeoutPolicy:1.0
//
/**
*
* The request timeout policy. This policy can be used to specify
* a maximum time limit for requests.
*
* @see TimeoutPolicy
*
**/
public interface RequestTimeoutPolicy extends RequestTimeoutPolicyOperations,
org.omg.CORBA.Policy
{
}
| 6,335 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/REQUEST_TIMEOUT_POLICY_ID.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/REQUEST_TIMEOUT_POLICY_ID:1.0
//
/**
*
* This policy type identifies the request timeout policy.
*
**/
public interface REQUEST_TIMEOUT_POLICY_ID
{
int value = (int)(1330577417L);
}
| 6,336 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectionReusePolicyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ConnectionReusePolicy:1.0
//
final public class ConnectionReusePolicyHolder implements org.omg.CORBA.portable.Streamable
{
public ConnectionReusePolicy value;
public
ConnectionReusePolicyHolder()
{
}
public
ConnectionReusePolicyHolder(ConnectionReusePolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = ConnectionReusePolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
ConnectionReusePolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return ConnectionReusePolicyHelper.type();
}
}
| 6,337 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DowncallEmitter.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public interface DowncallEmitter {
//
// Send and receive downcalls
//
// - The first parameter is the downcall to send/receive
//
// - If the second parameter is set to false, send/receive will be
// done non-blocking.
//
// - If the return value is true, it's safe to access or modify
// the downcall object. If the return value if false, accessing
// or modifying the downcall object is not allowed, for thread
// safety reasons. (Because the downcall object is not thread
// safe.)
//
boolean send(Downcall down, boolean block);
boolean receive(Downcall down, boolean block);
//
// Send and receive downcalls with one operation (for efficiency
// reasons)
//
boolean sendReceive(Downcall down);
}
| 6,338 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ParseParams.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public final class ParseParams {
//
// Parse a parameter list. Parameters are separated by whitespace.
// Quoted parameters are supported, as are escaped characters.
// Parsing stops when the end of the string is reached, or when
// an unescaped, unquoted comma character is encountered.
//
// The return value is -1 on end of string, or the position into the
// input string marking the location where parsing should resume.
//
// For example, consider this input string:
//
// abc 123 'ABC 123' "abc,123", def ghi
//
// The first execution will return a list containing the elements
// {"abc", "123", "ABC 123", "abc,123"}. The return value will point
// to the string " def ghi".
//
// A BAD_PARAM exception will be raised if a formatting error
// occurs.
//
public static int parse(String str, int start, java.util.Vector params) {
int pos = start;
final int strLen = str.length();
boolean error = false;
int result = -1;
while (pos < strLen && result == -1 && !error) {
//
// Skip leading whitespace
//
char ch = str.charAt(pos);
while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
pos++;
ch = str.charAt(pos);
}
int startPos = pos;
int endPos = 0;
char quote = 0;
boolean done = false;
while (!done && !error) {
if (pos == strLen) {
endPos = pos;
done = true;
} else {
ch = str.charAt(pos);
switch (ch) {
case ',':
if (quote == 0) {
endPos = pos;
result = pos + 1;
done = true;
} else
pos++;
break;
case ' ':
case '\t':
case '\n':
case '\r':
if (quote == 0) {
endPos = pos;
done = true;
} else
pos++;
break;
case '\\':
pos++;
if (pos == strLen)
error = true;
else
pos++;
break;
case '\'':
case '"':
if (quote == 0) {
if (pos > startPos) {
done = true;
endPos = pos;
} else {
quote = ch;
pos++;
}
} else if (quote == ch) {
quote = 0;
done = true;
endPos = pos;
pos++;
} else
error = true; // mismatched quotes
break;
default:
pos++;
break;
}
}
}
if (quote != 0)
error = true;
if (!error && pos > startPos) {
ch = str.charAt(startPos);
if (ch == '\'' || ch == '"')
startPos++;
int len = endPos - startPos;
StringBuffer buf = new StringBuffer(len);
int s = startPos;
while (s < endPos) {
ch = str.charAt(s);
if (ch != '\\')
buf.append(ch);
s++;
}
params.addElement(buf.toString());
}
}
return result;
}
}
| 6,339 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyFactoryHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory:1.0
//
final public class DispatchStrategyFactoryHelper
{
public static void
insert(org.omg.CORBA.Any any, DispatchStrategyFactory val)
{
any.insert_Object(val, type());
}
public static DispatchStrategyFactory
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "DispatchStrategyFactory");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory:1.0";
}
public static DispatchStrategyFactory
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, DispatchStrategyFactory val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static DispatchStrategyFactory
narrow(org.omg.CORBA.Object val)
{
try
{
return (DispatchStrategyFactory)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,340 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocationTransparencyPolicyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocationTransparencyPolicy:1.0
//
/**
*
* The location transparency policy. This policy is used to control
* how strict the ORB is in enforcing location transparency. This is
* useful for performance reasons.
*
**/
public interface LocationTransparencyPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:orb.yoko.apache.org/OB/LocationTransparencyPolicy/value:1.0
//
/**
*
* <code>LOCATION_TRANSPARENCY_STRICT</code> ensures strict
* location transparency is followed.
* <code>LOCATION_TRANSPARENCY_RELAXED</code> relaxes the location
* transparency guarantees for performance reasons. Specifically
* for collocated method invocations, the dispatch concurrency
* model will be ignored, and policy overrides are not
* removed. The default value is
* <code>LOCATION_TRANSPARENCY_STRICT</code>.
*
**/
short
value();
}
| 6,341 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetWriter.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public abstract class CodeSetWriter {
public final static int FIRST_CHAR = 22;
abstract void write_char(org.apache.yoko.orb.CORBA.OutputStream out, char v)
throws org.omg.CORBA.DATA_CONVERSION;
abstract void write_wchar(org.apache.yoko.orb.CORBA.OutputStream out, char v)
throws org.omg.CORBA.DATA_CONVERSION;
abstract int count_wchar(char v);
abstract void set_flags(int flags);
}
| 6,342 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/MessageQueue.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public class MessageQueue {
//
// Unsent requests
//
protected java.util.Vector unsent_ = new java.util.Vector();
//
// Requests that have been sent but are waiting for replies.
//
protected java.util.Vector pending_ = new java.util.Vector();
//
// Default constructor
//
MessageQueue() {
}
//
// Add new unsent buffer
//
public void add(ORBInstance orbInstance, org.apache.yoko.orb.OCI.Buffer buf) {
//
// Add new message to the message buffers
//
unsent_.addElement(new UnsentMessage(buf));
}
//
// Add new unsent downcall
//
public void add(ORBInstance orbInstance, Downcall down) {
//
// Add the message header
//
try {
//
// Save stream position and rewind
//
org.apache.yoko.orb.CORBA.OutputStream out = down.output();
int pos = out._OB_pos();
out._OB_pos(0);
//
// Write message header
//
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = down
.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance,
out, profileInfo);
//
// Write protocol header
//
String op = down.operation();
if (op.charAt(0) == '_' && op.equals("_locate"))
outgoing
.writeMessageHeader(
org.omg.GIOP.MsgType_1_1.LocateRequest, false,
pos - 12);
else
outgoing.writeMessageHeader(org.omg.GIOP.MsgType_1_1.Request,
false, pos - 12);
//
// Restore stream position
//
out._OB_pos(pos);
} catch (org.omg.CORBA.SystemException ex) {
Assert
._OB_assert(ex.completed == org.omg.CORBA.CompletionStatus.COMPLETED_NO);
down.setFailureException(ex);
return;
}
unsent_.addElement(new UnsentMessage(down));
}
//
// retrieve the first buffer in the queue
//
public org.apache.yoko.orb.OCI.Buffer getFirstUnsentBuffer() {
if (unsent_.isEmpty())
return null;
return ((UnsentMessage) unsent_.firstElement()).buf;
}
//
// Move the first unsent downcall to the list of pending downcalls
//
public Downcall moveFirstUnsentToPending() {
if (unsent_.isEmpty())
return null;
//
// Remove first downcall
//
UnsentMessage m = (UnsentMessage) unsent_.firstElement();
Downcall down = m.down;
unsent_.removeElementAt(0);
//
// Only add to pending if a response is expected
//
if (down != null) {
if (down.responseExpected()) {
down.setPending();
pending_.addElement(down);
} else {
down.setNoException(null);
}
}
return down;
}
//
// Find and remove a pending downcall
//
public Downcall findAndRemovePending(int reqId) {
for (int i = 0; i < pending_.size(); i++) {
Downcall d = (Downcall) pending_.elementAt(i);
if (d.requestId() == reqId) {
pending_.removeElementAt(i);
return d;
}
}
return null;
}
//
// Change the state of the queue due to an exception. Sets the
// state of all unsent and pending downcalls.
//
public void setException(int state, org.omg.CORBA.SystemException ex,
boolean notCompleted) {
//
// Always use a completion status of NO for unsent requests.
//
while (!unsent_.isEmpty()) {
UnsentMessage m = (UnsentMessage) unsent_.firstElement();
if (m.down != null)
m.down.setFailureException(ex);
unsent_.removeElementAt(0);
}
//
// If notCompleted is true, use a completion status of
// COMPLETED_NO for pending requests, otherwise use
// COMPLETED_MAYBE
//
org.omg.CORBA.SystemException except = Util.copySystemException(ex);
if (!notCompleted)
except.completed = org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE;
while (!pending_.isEmpty()) {
Downcall down = (Downcall) pending_.firstElement();
down.setFailureException(except);
pending_.removeElementAt(0);
}
}
//
// check if we have any unsent messages in the queue
//
public boolean hasUnsent() {
return !unsent_.isEmpty();
}
}
| 6,343 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ObjectKey.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// OB 3.x object keys:
// Transient: 0 + data
// Persistent: non-zero + data
//
// OB 4.x object key:
//
// The object key is: 0xabacab
// ['1'=transient|'0'=persistent]|[time\0]`poa \0 poa \0 poa \0\0 id'.
// NOTE: we then know that we've reached the id by the presence of the
// two \0\0. The time field we add for the POA create time (if
// transient) is current seconds. This is a tradeoff - it's most
// likely to be good enough.
//
package org.apache.yoko.orb.OB;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.yoko.orb.OB.IORUtil;
final public class ObjectKey {
static final Logger logger = Logger.getLogger(ObjectKey.class.getName());
public static byte[] CreateObjectKey(ObjectKeyData id) {
byte[] key;
//
// Count the number of bytes for the poas.
//
int len = id.serverId.length() + 1;
for (int i = 0; i < id.poaId.length; i++) {
len += id.poaId[i].length() + 1;
}
//
// Add one for the '\0'
//
len += 1;
//
// Add 4 for the magic number
//
len += 3;
//
// Add one for persistent bit
//
len += 1;
String time = null;
//
// If the POA is transient then add the time the poa was created
//
if (!id.persistent) {
time = "" + id.createTime;
len += time.length() + 1;
}
key = new byte[id.oid.length + len];
int data = 0;
//
// Add the magic number
//
key[data++] = (byte) 0xab;
key[data++] = (byte) 0xac;
key[data++] = (byte) 0xab;
//
// Add the persistent/transient information
//
if (id.persistent) {
key[data++] = (byte) '0';
} else {
key[data++] = (byte) '1';
int n = time.length();
for (int i = 0; i < n; i++) {
key[data++] = (byte) time.charAt(i);
}
data++;
}
//
// Copy in the data for the poas
//
int n = id.serverId.length();
for (int j = 0; j < n; j++) {
key[data++] = (byte) id.serverId.charAt(j);
}
data++;
for (int i = 0; i < id.poaId.length; i++) {
n = id.poaId[i].length();
for (int j = 0; j < n; j++) {
key[data++] = (byte) id.poaId[i].charAt(j);
}
data++;
}
//
// Add additional '\0'
//
data++;
System.arraycopy(id.oid, 0, key, data, id.oid.length);
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Created object key\n" + IORUtil.dump_octets(key));
}
return key;
}
//
// Parse an object key, filling in the fields of the ObjectKeyData.
// Return false if the object-key cannot be parsed, true otherwise.
//
public static boolean ParseObjectKey(byte[] key, ObjectKeyData keyData) {
//
// Parse out the POA's. This should be a sequence of strings
// terminated by two null values.
//
int data = 0;
int end = key.length;
if (logger.isLoggable(Level.FINE)) {
logger.fine("Parsing object key\n" + IORUtil.dump_octets(key));
}
//
// First try to figure out whether the object-key is OB 4.x
// format. Must be at least 4 bytes - magic + 1|0.
//
// OB 4.x magic number: abacab
//
if (key.length > 4 && key[0] == (byte) 0xab && key[1] == (byte) 0xac
&& key[2] == (byte) 0xab) {
data += 3;
if (key[data] == '0') // persistent
{
logger.fine("Parsing persistent object key");
keyData.persistent = true;
keyData.createTime = 0;
++data;
} else {
if (key[data] != '1') {
logger.fine("Characters '1' expected at position " + data);
return false;
}
keyData.persistent = false;
++data;
//
// Remember the start of the time stamp
//
int start = data;
while (data < end && key[data] != '\0') {
data++;
}
if (data >= end) {
logger.fine("Missing '\0' in key data");
return false;
}
String t = new String(key, start, data - start);
try {
keyData.createTime = Integer.valueOf(t).intValue();
} catch (NumberFormatException ex) {
logger.log(Level.FINE, "Invalid timestamp in key data", ex);
return false;
}
//
// skip the null byte
//
++data;
}
boolean first = true;
java.util.Vector poaId = new java.util.Vector();
while (data < end) {
//
// Remember the start of the POA name
//
int start = data;
while (data < end && key[data] != '\0') {
data++;
}
//
// Ensure that we haven't gone too far...
//
if (data >= end) {
logger.fine("Missing '\0' in key data");
return false;
}
//
// Append this to the sequence of POA's.
//
if (first) {
keyData.serverId = new String(key, start, data - start);
logger.fine("Parsed serverId=" + keyData.serverId);
first = false;
} else {
String element = new String(key, start, data - start);
logger.fine("Parsed POA name=" + element);
poaId.addElement(element);
}
//
// Skip this byte, check to see if we have another '\0'
//
if (key[++data] == '\0') {
//
// Skip this byte
//
++data;
break;
}
}
keyData.poaId = new String[poaId.size()];
poaId.copyInto(keyData.poaId);
//
// Verify that we haven't gone too far.
//
if (data >= end) {
logger.fine("Missing object id in key data");
return false;
}
//
// Remaining portion is the ObjectId.
//
int len = end - data;
keyData.oid = new byte[len];
System.arraycopy(key, data, keyData.oid, 0, len);
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Parsed object id is\n" + IORUtil.dump_octets(keyData.oid));
}
return true;
} else {
logger.fine("Invalid magic number in object key");
return false;
}
}
}
| 6,344 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RecursiveMutex.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public class RecursiveMutex {
private Thread owner_;
private boolean locked_;
private int count_;
public RecursiveMutex() {
owner_ = null;
locked_ = false;
count_ = 0;
}
public synchronized void lock() {
if (locked_ && Thread.currentThread() == owner_) {
count_++;
return;
}
while (locked_) {
try {
wait();
} catch (InterruptedException ex) {
}
}
//
// Assert: owner_ == null, count_ = 0
//
locked_ = true;
owner_ = Thread.currentThread();
count_ = 1;
}
public synchronized void unlock() {
// Assert: owner_ == Thread.currentThread, count_ > 0, locked = true
count_--;
if (count_ <= 0) {
locked_ = false;
owner_ = null;
notifyAll();
}
}
}
| 6,345 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyFactoryHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyFactory:1.0
//
final public class DispatchStrategyFactoryHolder implements org.omg.CORBA.portable.Streamable
{
public DispatchStrategyFactory value;
public
DispatchStrategyFactoryHolder()
{
}
public
DispatchStrategyFactoryHolder(DispatchStrategyFactory initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = DispatchStrategyFactoryHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
DispatchStrategyFactoryHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return DispatchStrategyFactoryHelper.type();
}
}
| 6,346 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RetryPolicyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/RetryPolicy:1.0
//
/**
*
* The retry policy. This policy is used to specify retry behavior after
* communication failures (i.e., <code>CORBA::TRANSIENT</code> and
* <code>CORBA::COMM_FAILURE</code> exceptions).
*
**/
public interface RetryPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:orb.yoko.apache.org/OB/RetryPolicy/retry_mode:1.0
//
/**
*
* For retry_mode <code>RETRY_NEVER</code> indicates that requests
* should never be retried, and the exception is re-thrown to the
* application. <code>RETRY_STRICT</code> will retry once if the
* exception completion status is <code>COMPLETED_NO</code>, in
* order to guarantee at-most-once semantics. <code>RETRY_ALWAYS</code>
* will retry once, regardless of the exception completion
* status. The default value is <code>RETRY_STRICT</code>.
*
* retry_interval is the time in milliseconds between reties. The
* default is 0.
*
* retry_max is the maximum number of retries. The default is 1.
*
* retry_remote determines whether or not to retry on exceptions
* received over-the-wire. The default is false: only retry on
* locally generated exceptions.
*
* <B>Note:</B> Many TCP/IP stacks do not provide a reliable
* indication of communication failure when sending smaller
* requests, therefore the failure may not be detected until the
* ORB attempts to read the reply. In this case, the ORB must
* assume that the remote end has received the request, in order
* to guarantee at-most-once semantics for the request. The
* implication is that when using the default setting of
* <code>RETRY_STRICT</code>, most communication failures will not
* cause a retry. This behavior can be relaxed using
* <code>RETRY_ALWAYS</code>.
*
**/
short
retry_mode();
//
// IDL:orb.yoko.apache.org/OB/RetryPolicy/retry_interval:1.0
//
/***/
int
retry_interval();
//
// IDL:orb.yoko.apache.org/OB/RetryPolicy/retry_max:1.0
//
/***/
int
retry_max();
//
// IDL:orb.yoko.apache.org/OB/RetryPolicy/retry_remote:1.0
//
/***/
boolean
retry_remote();
}
| 6,347 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ConnectionReusePolicyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ConnectionReusePolicy:1.0
//
final public class ConnectionReusePolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, ConnectionReusePolicy val)
{
any.insert_Object(val, type());
}
public static ConnectionReusePolicy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "ConnectionReusePolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/ConnectionReusePolicy:1.0";
}
public static ConnectionReusePolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, ConnectionReusePolicy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static ConnectionReusePolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (ConnectionReusePolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,348 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedClient.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class CollocatedClient extends Client implements DowncallEmitter {
//
// My Server
//
private CollocatedServer server_;
// ----------------------------------------------------------------------
// CollocatedClient public member implementations
// ----------------------------------------------------------------------
public CollocatedClient(CollocatedServer server, int concModel,
CodeConverters conv) {
super(concModel, conv);
server_ = server;
}
//
// Destroy the client
//
public void destroy() {
// Nothing to do here
}
//
// Get a new request ID
//
public int getNewRequestID() {
//
// This operation *must* delegate to CollocatedServer, because
// request IDs must be unique per CollocatedServer, not per
// CollocatedClient.
//
return server_.requestId();
}
//
// Get all profiles that are usable with this client
//
public org.apache.yoko.orb.OCI.ProfileInfo[] getUsableProfiles(
org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies) {
return server_.getUsableProfiles(ior, policies);
}
//
// Get the OCI connector info
//
public org.apache.yoko.orb.OCI.ConnectorInfo connectorInfo() {
return null; // There is no connector
}
//
// Get the OCI transport info
//
public org.apache.yoko.orb.OCI.TransportInfo transportInfo() {
return null; // There is no transport
}
//
// Start a downcall, returning a downcall emitter and an
// OutputStream for marshalling a request
//
public DowncallEmitter startDowncall(Downcall down,
org.apache.yoko.orb.CORBA.OutputStreamHolder out) {
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
out.value = new org.apache.yoko.orb.CORBA.OutputStream(buf);
return this;
}
//
// Checks whether this client is equal to another client
//
public boolean matches(Client other) {
if (!!!(other instanceof CollocatedClient)) return false;
CollocatedClient that = (CollocatedClient) other;
return (this.server_ == that.server_);
}
//
// Force connection establishment
//
public void bind(int connectTimeout) {
// nothing to do
}
//
// Determines whether this client supports twoway invocations
//
public boolean twoway() {
return true;
}
//
// Send and receive downcalls
//
// - The first parameter is the downcall to send/receive
//
// - If the second parameter is set to false, send/receive will be
// done non-blocking.
//
// - If the return value is true, it's safe to access or modify
// the downcall object. If the return value if false, accessing
// or modifying the downcall object is not allowed, for thread
// safety reasons. (Because the downcall object is not thread
// safe.)
//
public boolean send(Downcall down, boolean block) {
return server_.send(down, block);
}
public boolean receive(Downcall down, boolean block) {
return server_.receive(down, block);
}
//
// Send and receive downcalls with one operation (for efficiency
// reasons)
//
public boolean sendReceive(Downcall down) {
return server_.sendReceive(down);
}
public org.omg.IOP.ServiceContext[] getAMIRouterSCL() {
return null;
}
}
| 6,349 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RETRY_NEVER.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/RETRY_NEVER:1.0
//
/**
*
* The <code>RETRY_NEVER</code> RetryPolicy value.
*
**/
public interface RETRY_NEVER
{
short value = (short)(0L);
}
| 6,350 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocateRequestPolicyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocateRequestPolicy:1.0
//
final public class LocateRequestPolicyHolder implements org.omg.CORBA.portable.Streamable
{
public LocateRequestPolicy value;
public
LocateRequestPolicyHolder()
{
}
public
LocateRequestPolicyHolder(LocateRequestPolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = LocateRequestPolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
LocateRequestPolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return LocateRequestPolicyHelper.type();
}
}
| 6,351 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeConverters.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class CodeConverters {
public CodeConverterBase inputCharConverter;
public CodeConverterBase outputCharConverter;
public CodeConverterBase inputWcharConverter;
public CodeConverterBase outputWcharConverter;
public CodeConverters() {
}
public CodeConverters(CodeConverters c) {
if (c != null) {
inputCharConverter = c.inputCharConverter;
outputCharConverter = c.outputCharConverter;
inputWcharConverter = c.inputWcharConverter;
outputWcharConverter = c.outputWcharConverter;
}
}
public boolean equals(java.lang.Object obj) {
CodeConverters conv = (CodeConverters) obj;
if (conv == null)
return false;
boolean a = false;
boolean b = false;
boolean c = false;
boolean d = false;
if (inputCharConverter == null && conv.inputCharConverter == null)
a = true;
else if (inputCharConverter != null
&& inputCharConverter.equals(conv.inputCharConverter))
a = true;
if (outputCharConverter == null && conv.outputCharConverter == null)
b = true;
else if (outputCharConverter != null
&& outputCharConverter.equals(conv.outputCharConverter))
b = true;
if (inputWcharConverter == null && conv.inputWcharConverter == null)
c = true;
else if (inputWcharConverter != null
&& inputWcharConverter.equals(conv.inputWcharConverter))
c = true;
if (outputWcharConverter == null && conv.outputWcharConverter == null)
d = true;
else if (outputWcharConverter != null
&& outputWcharConverter.equals(conv.outputWcharConverter))
d = true;
return a && b && c && d;
}
public int hashCode() {
int result;
result = (inputCharConverter != null ? inputCharConverter.hashCode() : 0);
result = 29 * result + (outputCharConverter != null ? outputCharConverter.hashCode() : 0);
result = 29 * result + (inputWcharConverter != null ? inputWcharConverter.hashCode() : 0);
result = 29 * result + (outputWcharConverter != null ? outputWcharConverter.hashCode() : 0);
return result;
}
}
| 6,352 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/InterceptorPolicyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/InterceptorPolicy:1.0
//
final public class InterceptorPolicyHolder implements org.omg.CORBA.portable.Streamable
{
public InterceptorPolicy value;
public
InterceptorPolicyHolder()
{
}
public
InterceptorPolicyHolder(InterceptorPolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = InterceptorPolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
InterceptorPolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return InterceptorPolicyHelper.type();
}
}
| 6,353 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ClientManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.Arrays;
import java.util.Vector;
import java.util.logging.Logger;
import org.apache.yoko.orb.OCI.ConnectorInfo;
import org.omg.CORBA.Policy;
import org.omg.IOP.IOR;
import org.omg.PortableServer.POAManagerPackage.State;
public final class ClientManager {
static final Logger logger = Logger.getLogger(ClientManager.class.getName());
private boolean destroy_; // True if destroy() was called
//
// The ORB Instance
//
private ORBInstance orbInstance_;
//
// All clients
//
private Vector<Client> allClients_ = new Vector<>();
//
// All reusable clients
//
private Vector<Client> reusableClients_ = new Vector<>();
//
// The concurrency model with which new Clients are created
//
private int concModel_;
// ----------------------------------------------------------------------
// ClientManager private and protected member implementations
// ----------------------------------------------------------------------
protected void finalize() throws Throwable {
Assert._OB_assert(destroy_);
Assert._OB_assert(allClients_.isEmpty());
Assert._OB_assert(reusableClients_.isEmpty());
super.finalize();
}
// ----------------------------------------------------------------------
// ClientManager package member implementations
// ----------------------------------------------------------------------
synchronized void destroy() {
//
// Don't destroy twice
//
if (destroy_) {
return;
}
//
// Set the destroy flag
//
destroy_ = true;
//
// Destroy all clients
//
for (Client c : allClients_) c.destroy();
//
// Reset internal data
//
orbInstance_ = null;
allClients_.removeAllElements();
reusableClients_.removeAllElements();
}
// ----------------------------------------------------------------------
// ClientManager public member implementations
// ----------------------------------------------------------------------
public ClientManager(int concModel) {
destroy_ = false;
concModel_ = concModel;
}
public void setORBInstance(ORBInstance instance) {
orbInstance_ = instance;
}
//
// Get a list of ClientProfilePairs for an IOR and a list of policies
//
public synchronized Vector<ClientProfilePair> getClientProfilePairs(IOR ior, Policy[] policies) {
Assert._OB_assert(ior.type_id != null);
//
// Can't create a Client for a nil object
//
if (ior.type_id.length() == 0 && ior.profiles.length == 0) {
throw new org.omg.CORBA.INV_OBJREF("Object reference is nil");
}
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_) {
throw new org.omg.CORBA.INITIALIZE(org.apache.yoko.orb.OB.MinorCodes
.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
//
// Find out whether private clients are requested
//
boolean privateClients = false;
for (Policy pol : policies) {
if (pol.policy_type() == CONNECTION_REUSE_POLICY_ID.value) {
privateClients = !!!(ConnectionReusePolicyHelper.narrow(pol).value());
break;
}
}
//
// Get the protocol policy, if any
//
ProtocolPolicy protocolPolicy = null;
for (Policy pol : policies) {
if (pol.policy_type() == PROTOCOL_POLICY_ID.value) {
protocolPolicy = ProtocolPolicyHelper.narrow(pol);
break;
}
}
//
// check whether the BiDir policy is enabled
//
boolean enableBidir = false;
for (Policy pol : policies) {
if (pol.policy_type() == org.omg.BiDirPolicy.BIDIRECTIONAL_POLICY_TYPE.value) {
org.omg.BiDirPolicy.BidirectionalPolicy p = org.omg.BiDirPolicy.BidirectionalPolicyHelper
.narrow(pol);
if (p.value() == org.omg.BiDirPolicy.BOTH.value) {
enableBidir = true;
}
}
}
Vector<ClientProfilePair> pairs = new Vector<>();
//
// First try to create CollocatedClients
//
org.apache.yoko.orb.OBPortableServer.POAManagerFactory pmFactory = orbInstance_.getPOAManagerFactory();
for (org.omg.PortableServer.POAManager mgr : pmFactory.list()) {
try {
boolean local = false;
for (org.apache.yoko.orb.OCI.Acceptor acceptor : ((org.apache.yoko.orb.OBPortableServer.POAManager)mgr).get_acceptors()) {
org.apache.yoko.orb.OCI.ProfileInfo[] localProfileInfos = acceptor.get_local_profiles(ior);
if (localProfileInfos.length > 0) {
local = true;
}
}
// we can get into hang situations if we return a collocated server for an
// inactive POA. This can happen with the RootPOA, which is generally not activated.
if (local && mgr.get_state() == State.ACTIVE) {
//
// Retrieve the CollocatedServer from the POAManager
//
org.apache.yoko.orb.OBPortableServer.POAManager_impl manager = (org.apache.yoko.orb.OBPortableServer.POAManager_impl) mgr;
CollocatedServer collocatedServer = manager._OB_getCollocatedServer();
//
// Create a new CollocatedClient and add the new client to
// both the list of all clients, and the list of clients
// that is returned
//
CodeConverters conv = new CodeConverters();
Client client = new CollocatedClient(collocatedServer, concModel_, conv);
allClients_.addElement(client);
for (org.apache.yoko.orb.OCI.ProfileInfo profileInfo : client.getUsableProfiles(ior, policies)) {
ClientProfilePair pair = new ClientProfilePair();
pair.client = client;
pair.profile = profileInfo;
pairs.addElement(pair);
}
//
// TODO: Introduce reusable CollocatedClients?
//
}
} catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ignored) {
}
}
//
// If no private clients are requested, add all existing reusable
// clients which are usable for the given IOR and policies
//
if (!privateClients) {
for (Client reusableClient : reusableClients_) {
//
// Skip any client whose protocol is not present in the
// protocol list
//
if (protocolPolicy != null) {
org.apache.yoko.orb.OCI.ConnectorInfo info = reusableClient.connectorInfo();
if (info != null && !protocolPolicy.contains(info.id())) {
continue;
}
}
for (org.apache.yoko.orb.OCI.ProfileInfo profileInfo : reusableClient.getUsableProfiles(ior, policies)) {
ClientProfilePair pair = new ClientProfilePair();
pair.client = reusableClient;
pair.profile = profileInfo;
pairs.addElement(pair);
}
}
}
//
// Finally, create new GIOPClients for all connectors we can get
//
org.apache.yoko.orb.OCI.ConFactoryRegistry conFactoryRegistry = orbInstance_.getConFactoryRegistry();
for (org.apache.yoko.orb.OCI.ConFactory factory : conFactoryRegistry.get_factories()) {
for (org.apache.yoko.orb.OCI.Connector connector : factory.create_connectors(ior, policies)) {
//
// Skip any connector whose protocol is not present in the
// protocol list
//
if (protocolPolicy != null && !protocolPolicy.contains(connector.id())) {
continue;
}
//
// Get all usable profiles
//
org.apache.yoko.orb.OCI.ProfileInfo[] profileInfos = connector.get_usable_profiles(ior, policies);
Assert._OB_assert(profileInfos.length != 0);
//
// Create a new GIOPClient for each usable profile, and set
// the concurrency model and code converters. Filter out
// clients that are equivalent to other clients we already
// have.
//
for (org.apache.yoko.orb.OCI.ProfileInfo profileInfo: profileInfos) {
CodeConverters conv = CodeSetUtil.getCodeConverters(orbInstance_, profileInfo);
Client newClient = new GIOPClient(orbInstance_, connector, concModel_, conv, enableBidir);
if (!pairs.isEmpty()) {
boolean matched = false;
for (ClientProfilePair pair : pairs) {
if (pair.client.matches(newClient)) {
matched = true;
break;
}
}
if (matched) {
newClient.destroy();
continue;
}
}
//
// Add the new client to the list of all clients
//
allClients_.addElement(newClient);
//
// Add client/profile pairs
//
for (org.apache.yoko.orb.OCI.ProfileInfo clientProfileInfo : newClient.getUsableProfiles(ior, policies)) {
ClientProfilePair pair = new ClientProfilePair();
pair.client = newClient;
pair.profile = clientProfileInfo;
pairs.addElement(pair);
}
//
// If no private clients have been requested, also add the
// client to the list of existing reusable clients
//
if (!privateClients) {
reusableClients_.addElement(newClient);
}
}
}
}
//
// If there is a protocol policy, then the client/profile pairs
// have already been filtered. Now we need to sort the pairs in
// the order specified by the policy. Note that clients which
// do not have a ConnectorInfo are assumed to be local, and will
// be ordered before the other clients.
//
if (!pairs.isEmpty() && protocolPolicy != null) {
String[] protocols = protocolPolicy.value();
Vector<ClientProfilePair> newPairs = new Vector<>();
//
// First, add any pairs whose clients do not have ConnectorInfo
//
for (ClientProfilePair pair : pairs) {
if (pair.client.connectorInfo() == null) {
newPairs.addElement(pair);
}
}
//
// Next, add the pairs in the order specified by the policy
//
for (String protocol : protocols) {
for (ClientProfilePair pair : pairs) {
ConnectorInfo info = pair.client.connectorInfo();
if (info != null && protocol.equals(info.id())) {
newPairs.addElement(pair);
}
}
}
pairs = newPairs;
}
//
// If we still don't have any client/profile pairs, throw a
// TRANSIENT exception
//
if (pairs.isEmpty()) {
throw new org.omg.CORBA.TRANSIENT(org.apache.yoko.orb.OB.MinorCodes
.describeTransient(org.apache.yoko.orb.OB.MinorCodes.MinorNoUsableProfileInIOR)
+ "Unable to create client",
org.apache.yoko.orb.OB.MinorCodes.MinorNoUsableProfileInIOR,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
//
// Increment the usage count on all clients
//
for (ClientProfilePair pair : pairs) {
pair.client.incUsage();
}
return pairs;
}
public synchronized void releaseClient(Client client) {
//
// The ORB destroys this object, so it's an initialization error
// if this operation is called after ORB destruction
//
if (destroy_) {
return;
}
//
// TODO:
//
// We need to examine the entire shutdown sequence again since the
// GIOPClientWorkers and what-not get destroyed after the ORB has
// been marked as destroyed
//
// if(destroy_)
// throw new org.omg.CORBA.INITIALIZE(
// org.apache.yoko.orb.OB.MinorCodes.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
// org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed,
// org.omg.CORBA.CompletionStatus.COMPLETED_NO);
boolean inUse = client.decUsage();
if (!inUse) {
reusableClients_.remove(client);
if (allClients_.remove(client)) {
client.destroy();
} else {
Assert._OB_assert("Release called on unknown client");
}
}
}
public boolean equivalent(org.omg.IOP.IOR ior1, org.omg.IOP.IOR ior2) {
org.apache.yoko.orb.OCI.ConFactoryRegistry conFactoryRegistry = orbInstance_.getConFactoryRegistry();
for (org.apache.yoko.orb.OCI.ConFactory factory : conFactoryRegistry.get_factories()) {
if (!!!factory.equivalent(ior1, ior2)) {
return false;
}
}
return true;
}
public int hash(org.omg.IOP.IOR ior, int maximum) {
return Arrays.hashCode(orbInstance_.getConFactoryRegistry().get_factories());
}
}
| 6,354 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchRequestHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchRequest:1.0
//
final public class DispatchRequestHolder implements org.omg.CORBA.portable.Streamable
{
public DispatchRequest value;
public
DispatchRequestHolder()
{
}
public
DispatchRequestHolder(DispatchRequest initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = DispatchRequestHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
DispatchRequestHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return DispatchRequestHelper.type();
}
}
| 6,355 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ThreadPoolIdHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ThreadPoolId:1.0
//
final public class ThreadPoolIdHelper
{
public static void
insert(org.omg.CORBA.Any any, int val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static int
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "ThreadPoolId", orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong));
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/ThreadPoolId:1.0";
}
public static int
read(org.omg.CORBA.portable.InputStream in)
{
int _ob_v;
_ob_v = in.read_ulong();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, int val)
{
out.write_ulong(val);
}
}
| 6,356 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PIUpcall.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public final class PIUpcall extends Upcall {
//
// The PortableInterceptor manager
//
protected PIManager piManager_;
//
// The ServerRequestInfo object provided by the interceptors
//
protected org.omg.PortableInterceptor.ServerRequestInfo requestInfo_;
// ----------------------------------------------------------------------
// PIUpcall public member implementations
// ----------------------------------------------------------------------
public PIUpcall(ORBInstance orbInstance, UpcallReturn upcallReturn,
org.apache.yoko.orb.OCI.ProfileInfo profileInfo,
org.apache.yoko.orb.OCI.TransportInfo transportInfo, int requestId,
String op, org.apache.yoko.orb.CORBA.InputStream in,
org.omg.IOP.ServiceContext[] requestSCL, PIManager piManager) {
super(orbInstance, upcallReturn, profileInfo, transportInfo, requestId,
op, in, requestSCL);
piManager_ = piManager;
}
public void setArgDesc(ParameterDesc[] argDesc, ParameterDesc retDesc,
org.omg.CORBA.TypeCode[] exceptionTC) {
piManager_.serverParameterDesc(requestInfo_, argDesc, retDesc,
exceptionTC);
}
public void setArguments(org.omg.CORBA.NVList args) {
piManager_.serverArguments(requestInfo_, args);
}
public void setResult(org.omg.CORBA.Any any) {
piManager_.serverResult(requestInfo_, any);
}
public void receiveRequestServiceContexts(org.omg.CORBA.Policy[] policies,
byte[] adapterId, byte[] objectId,
org.omg.PortableInterceptor.ObjectReferenceTemplate adapterTemplate)
throws LocationForward {
//
// Copy requestSCL_ into a Vector
//
java.util.Vector requestSCL = new java.util.Vector(requestSCL_.length);
for (int i = 0; i < requestSCL_.length; i++)
requestSCL.addElement(requestSCL_[i]);
//
// Create the requestInfo_
//
requestInfo_ = piManager_.serverCreateRequestInfo(op_,
upcallReturn_ != null, policies, adapterId, objectId,
adapterTemplate, requestSCL, replySCL_, transportInfo_);
//
// Call the receive_request_service_contexts interception
// point
//
piManager_.serverReceiveRequestServiceContexts(requestInfo_);
}
public void postUnmarshal() throws LocationForward {
piManager_.serverReceiveRequest(requestInfo_);
super.postUnmarshal();
}
public org.apache.yoko.orb.CORBA.OutputStream preMarshal()
throws LocationForward {
piManager_.serverSendReply(requestInfo_);
return super.preMarshal();
}
//
// NOTE: Not used in Java
//
public void setUserException(org.omg.CORBA.UserException ex) {
try {
piManager_.serverSendException(requestInfo_, false, ex);
} catch (org.omg.CORBA.SystemException e) {
setSystemException(e);
return;
} catch (LocationForward e) {
setLocationForward(e.ior, e.perm);
return;
}
super.setUserException(ex);
}
public void setUserException(org.omg.CORBA.Any any) {
try {
org.omg.CORBA.UnknownUserException uex = new org.omg.CORBA.UnknownUserException(
any);
piManager_.serverSendException(requestInfo_, false, uex);
} catch (org.omg.CORBA.SystemException e) {
setSystemException(e);
return;
} catch (LocationForward e) {
setLocationForward(e.ior, e.perm);
return;
}
super.setUserException(any);
}
//
// This method is needed only in Java. Marshalling is handled by the
// skeletons. If called by a portable skeleton, the exception will be
// null.
//
public org.apache.yoko.orb.CORBA.OutputStream beginUserException(
org.omg.CORBA.UserException ex) {
try {
piManager_.serverSendException(requestInfo_, false, ex);
} catch (org.omg.CORBA.SystemException e) {
setSystemException(e);
return null;
} catch (LocationForward e) {
setLocationForward(e.ior, e.perm);
return null;
}
return super.beginUserException(ex);
}
public void setSystemException(org.omg.CORBA.SystemException ex) {
try {
piManager_.serverSendException(requestInfo_, true, ex);
} catch (org.omg.CORBA.SystemException e) {
setSystemException(e);
return;
} catch (LocationForward e) {
setLocationForward(e.ior, e.perm);
return;
}
super.setSystemException(ex);
}
public void setLocationForward(org.omg.IOP.IOR ior, boolean perm) {
try {
piManager_.serverSendLocationForward(requestInfo_, ior);
} catch (org.omg.CORBA.SystemException e) {
setSystemException(e);
return;
} catch (LocationForward e) {
setLocationForward(e.ior, e.perm);
return;
}
super.setLocationForward(ior, perm);
}
public void setServantAndPOA(org.omg.PortableServer.Servant servant,
org.apache.yoko.orb.OBPortableServer.POA_impl poa) {
piManager_.serverSetupServant(requestInfo_, servant, poa);
super.setServantAndPOA(servant, poa);
}
//
// Notify the Upcall about a potential change in the thread context
//
public void contextSwitch() {
piManager_.serverContextSwitch(requestInfo_);
}
}
| 6,357 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CONNECT_TIMEOUT_POLICY_ID.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/CONNECT_TIMEOUT_POLICY_ID:1.0
//
/**
*
* This policy type identifies the connect timeout policy.
*
**/
public interface CONNECT_TIMEOUT_POLICY_ID
{
int value = (int)(1330577416L);
}
| 6,358 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ZeroPortPolicy_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.ZERO_PORT_POLICY_ID;
import org.apache.yoko.orb.OB.ZeroPortPolicy;
final public class ZeroPortPolicy_impl extends org.omg.CORBA.LocalObject
implements ZeroPortPolicy {
private boolean value_;
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public boolean value() {
return value_;
}
public int policy_type() {
return ZERO_PORT_POLICY_ID.value;
}
public org.omg.CORBA.Policy copy() {
return this;
}
public void destroy() {
}
public ZeroPortPolicy_impl(boolean r) {
value_ = r;
}
}
| 6,359 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPConnectionThreaded.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import static java.util.concurrent.TimeUnit.SECONDS;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;
import java.util.logging.Logger;
public final class GIOPConnectionThreaded extends GIOPConnection {
static final Logger logger = Logger.getLogger(GIOPConnectionThreaded.class.getName());
// ----------------------------------------------------------------
// Inner helper classes
// ----------------------------------------------------------------
public final class Shutdown implements Runnable {
public void run() {
try {
execShutdown();
} catch (RuntimeException ex) {
Assert._OB_assert(ex);
}
}
}
public final class Receiver implements Runnable {
Receiver() {
receiverLock.readLock().lock();
}
public void run() {
try {
execReceive();
} catch (RuntimeException ex) {
Assert._OB_assert(ex);
} finally {
receiverLock.readLock().unlock();
}
}
}
// ----------------------------------------------------------------
// Member data
// ----------------------------------------------------------------
//
//
// the holding monitor to pause the receiver threads
//
protected java.lang.Object holdingMonitor_ = new java.lang.Object();
//
// are we holding or not
//
protected boolean holding_ = true;
//
// sending mutex to prevent multiple threads from sending at once
//
protected java.lang.Object sendMutex_ = new java.lang.Object();
private boolean shuttingDown;
private final ReentrantReadWriteLock receiverLock = new ReentrantReadWriteLock(true);
// ----------------------------------------------------------------
// Protected Methods
// ----------------------------------------------------------------
//
// add a new receiver thread
// Assumes 'this' is synchronized on entry
//
protected void addReceiverThread() {
getExecutor().submit(new Receiver());
}
//
// pause a thread on a holding monitor if turned on
//
protected void pauseThread() {
synchronized (holdingMonitor_) {
while (holding_) {
try {
holdingMonitor_.wait();
} catch (InterruptedException ex) {
//
// ignore exception and continue to wait
//
}
}
}
}
//
// abortive shutdown method from GIOPConnection
//
protected void abortiveShutdown() {
//
// disable any ACM timeouts now
//
ACM_disableIdleMonitor();
//
// The transport must be able to send in order to send the error
// message...
//
if (transport_.mode() != org.apache.yoko.orb.OCI.SendReceiveMode.ReceiveOnly) {
try {
//
// Send a MessageError message
//
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
12);
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = new org.apache.yoko.orb.OCI.ProfileInfo();
synchronized (this) {
profileInfo.major = giopVersion_.major;
profileInfo.minor = giopVersion_.minor;
}
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(
orbInstance_, out, profileInfo);
outgoing.writeMessageHeader(
org.omg.GIOP.MsgType_1_1.MessageError, false, 0);
out._OB_pos(0);
synchronized (sendMutex_) {
transport_.send(out._OB_buffer(), true);
}
Assert._OB_assert(out._OB_buffer().is_full());
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
return;
}
}
//
// If we are in StateError, we don't go through all the hula hoop
// with continuing to receive messages until the peer
// closes. Instead, we just close the connection, meaning that we
// can't be 100% sure that the peer gets the last message.
//
processException(State.Closed, new org.omg.CORBA.TRANSIENT(org.apache.yoko.orb.OB.MinorCodes
.describeTransient(org.apache.yoko.orb.OB.MinorCodes.MinorForcedShutdown),
org.apache.yoko.orb.OB.MinorCodes.MinorForcedShutdown,
org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE), false);
arrive();
}
//
// graceful shutdown method
//
synchronized protected void gracefulShutdown() {
//
// disable any ACM idle timeouts now
//
ACM_disableIdleMonitor();
//
// don't shutdown if there are pending upcalls
//
if (upcallsInProgress_ > 0 || state_ != State.Closing) {
logger.fine("pending upcalls: " + upcallsInProgress_ + " state: " + state_);
return;
}
//
// send a CloseConnection if we can
//
if (canSendCloseConnection()) {
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
12);
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = new org.apache.yoko.orb.OCI.ProfileInfo();
profileInfo.major = giopVersion_.major;
profileInfo.minor = giopVersion_.minor;
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(
orbInstance_, out, profileInfo);
outgoing.writeMessageHeader(
org.omg.GIOP.MsgType_1_1.CloseConnection, false, 0);
messageQueue_.add(orbInstance_, out._OB_buffer());
} else {
logger.fine("could not send close connection message");
}
//
// now create the shutdown thread
//
try {
if (shuttingDown)
return;
shuttingDown = true;
//
// start the shutdown thread
//
try {
getExecutor().submit(new Shutdown());
} catch (RejectedExecutionException ree) {
logger.log(Level.WARNING, "Could not submit shutdown task", ree);
}
} catch (OutOfMemoryError ex) {
processException(State.Closed, new org.omg.CORBA.IMP_LIMIT(
org.apache.yoko.orb.OB.MinorCodes.describeImpLimit(org.apache.yoko.orb.OB.MinorCodes.MinorThreadLimit),
org.apache.yoko.orb.OB.MinorCodes.MinorThreadLimit,
org.omg.CORBA.CompletionStatus.COMPLETED_NO), false);
} finally {
arrive();
}
}
private void arrive() {
if ((properties_ & Property.CreatedByClient) != 0)
orbInstance_.getClientPhaser().arriveAndDeregister();
else
orbInstance_.getServerPhaser().arriveAndDeregister();
}
// ----------------------------------------------------------------
// Public Methods
// ----------------------------------------------------------------
//
// client-side constructor
//
public GIOPConnectionThreaded(ORBInstance orbInstance,
org.apache.yoko.orb.OCI.Transport transport, GIOPClient client) {
super(orbInstance, transport, client);
orbInstance.getClientPhaser().register();
start();
}
//
// server-side constructor
//
public GIOPConnectionThreaded(ORBInstance orbInstance,
org.apache.yoko.orb.OCI.Transport transport, OAInterface oa) {
super(orbInstance, transport, oa);
orbInstance.getServerPhaser().register();
}
private ExecutorService getExecutor() {
if ((properties_ & Property.CreatedByClient) != 0)
return orbInstance_.getClientExecutor();
else
return orbInstance_.getServerExecutor();
}
//
// called from the shutdown thread to initiate shutdown
//
public void execShutdown() {
if (canSendCloseConnection()
&& transport_.mode() != org.apache.yoko.orb.OCI.SendReceiveMode.ReceiveOnly) {
try {
synchronized (this) {
while (messageQueue_.hasUnsent()) {
//
// Its possible the CloseConnection message got sent
// via another means.
//
org.apache.yoko.orb.OCI.Buffer buf = messageQueue_
.getFirstUnsentBuffer();
if (buf != null) {
synchronized (sendMutex_) {
transport_.send(buf, true);
}
messageQueue_.moveFirstUnsentToPending();
}
}
}
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
return;
}
}
//
// shutdown the transport
// synchronization on sendMutex_ is needed to avoid a deadlock in some oracle and ibm jdks between send and shutdown
// https://bugs.openjdk.java.net/browse/JDK-8013809 deadlock in SSLSocketImpl between between write and close
//
synchronized (sendMutex_) {
transport_.shutdown();
}
//
// Shutdown the receiver threads. There may not be a receiver
// thread if the transport is SendOnly.
//
try {
receiverLock.writeLock().tryLock(shutdownTimeout_, SECONDS);
} catch (InterruptedException e) {
}
try {
//
// We now close the connection actively, since it may still be
// open under certain circumstances. For example, the receiver
// thread may not have terminated yet or the receive thread might
// set the state to GIOPState::Error before termination.
//
processException(State.Closed, new org.omg.CORBA.TRANSIENT(org.apache.yoko.orb.OB.MinorCodes
.describeTransient(org.apache.yoko.orb.OB.MinorCodes.MinorForcedShutdown),
org.apache.yoko.orb.OB.MinorCodes.MinorForcedShutdown,
org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE), false);
} finally {
if (receiverLock.isWriteLockedByCurrentThread()) {
receiverLock.writeLock().unlock();
}
}
}
//
// called from a receiver thread to perform a reception
//
public void execReceive() {
logger.fine("Receiving incoming message " + this);
GIOPIncomingMessage inMsg = new GIOPIncomingMessage(orbInstance_);
org.apache.yoko.orb.OCI.Buffer buf = null;
while (true) {
//
// Setup the incoming message buffer
//
Assert._OB_assert(buf == null);
buf = new org.apache.yoko.orb.OCI.Buffer(12);
//
// Receive header, blocking, detect connection loss
//
try {
logger.fine("Reading message header");
transport_.receive(buf, true);
Assert._OB_assert(buf.is_full());
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
break;
}
//
// Header is complete
//
try {
inMsg.extractHeader(buf);
logger.fine("Header received for message of size " + inMsg.size());
buf.realloc(12 + inMsg.size());
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Error, ex, false);
break;
}
if (!buf.is_full()) {
//
// Receive body, blocking
//
try {
logger.fine("Receiving message body of size " + inMsg.size());
transport_.receive(buf, true);
Assert._OB_assert(buf.is_full());
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
break;
}
}
if (logger.isLoggable(Level.FINE)) {
logger.fine("Message body received ");
int currentpos = buf.pos_;
buf.pos_ = 0;
logger.fine("Received message are: \n" + buf.dumpData());
buf.pos_ = currentpos;
}
//
// pause thread if necessary
//
pauseThread();
//
// If we are not in StateActive or StateClosing, stop this
// thread. We do *not* stop this thread if we are in
// StateClosing, since we must continue to read data from
// the Transport to make sure that no messages can get
// lost upon close, and to make sure that CloseConnection
// messages from the peer are processed.
//
synchronized (this) {
if ((enabledOps_ & AccessOp.Read) == 0)
{
break;
}
}
//
// the upcall to invoke
//
Upcall upcall = null;
try {
org.apache.yoko.orb.OCI.Buffer bufCopy = buf;
buf = null;
if (inMsg.consumeBuffer(bufCopy) == true) {
upcall = processMessage(inMsg);
}
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Error, ex, false);
break;
}
//
// A valid upcall means we have a full message and not just
// a fragment or error, so we can proceed to invoke it
//
if (upcall != null) {
logger.fine("Processing message using upcall " + upcall.getClass().getName());
//
// in the BiDir case, this upcall could result in a
// nested call back and forth. This requires a new
// receiverThread to handle the reply (the invocation of
// the upcall doesn't return back into a receiving state
// until the function processing is done)
//
boolean haveBidirSCL = transport_.get_info().received_bidir_SCL();
//
// if we have received a bidirectional SCL then we need
// to spawn a new thread to handle nested calls (just in
// case)
//
if (haveBidirSCL) {
addReceiverThread();
}
upcall.invoke();
//
// if we've spawned a new thread to handle nested calls
// then we can quit this thread because we know another
// will be ready to take over anyway
//
if (haveBidirSCL) {
break;
}
}
}
}
//
// ACM callback method on ACM signal
//
synchronized public void ACM_callback() {
if (acmTimer_ != null) {
acmTimer_.cancel();
acmTimer_ = null;
}
if (acmTask_ != null) {
acmTask_.cancel();
acmTask_ = null;
}
//
// don't shutdown if there are unsent messages or if there are
// upcalls in progress
//
if (messageQueue_.hasUnsent() || (upcallsInProgress_ > 0)) {
ACM_enableIdleMonitor();
return;
}
//
// shutdown gracefully
//
setState(State.Closing);
}
//
// client-side send method (from DowncallEmitter)
//
public boolean send(Downcall down, boolean block) {
Assert._OB_assert(transport_.mode() != org.apache.yoko.orb.OCI.SendReceiveMode.ReceiveOnly);
Assert._OB_assert(down.unsent() == true);
logger.fine("Sending a request with Downcall of type " + down.getClass().getName() + " for operation " + down.operation() + " on transport " + transport_);
//
// if we send off a message in the loop, this var might help us
// to prevent a further locking to check the status
//
boolean msgSentMarked = false;
//
// if we don't have writing turned on then we must throw a
// TRANSIENT to the caller indicating this
//
synchronized (this) {
if ((enabledOps_ & AccessOp.Write) == 0) {
logger.fine("writing not enabled for this connection");
down.setFailureException(new org.omg.CORBA.TRANSIENT());
return true;
}
//
// make the downcall thread-safe
//
if (down.responseExpected()) {
down.allowWaiting();
}
//
// buffer the request
//
messageQueue_.add(orbInstance_, down);
//
// check the sent status while we're locked
//
if ((properties_ & Property.RequestSent) != 0) {
msgSentMarked = true;
}
}
//
// now prepare to send it either blocking or non-blocking
// depending on the call mode param
//
if (block) {
//
// Get the request timeout
//
int t = down.policies().requestTimeout;
int msgcount = 0;
//
// now we can start sending off the messages
//
while (true) {
//
// Get a message to send from the unsent queue
//
org.apache.yoko.orb.OCI.Buffer buf;
Downcall nextDown;
synchronized (this) {
if (!down.unsent()) {
break;
}
Assert._OB_assert(messageQueue_.hasUnsent());
buf = messageQueue_.getFirstUnsentBuffer();
nextDown = messageQueue_.moveFirstUnsentToPending();
}
//
// Send the message
//
try {
synchronized (sendMutex_) {
if (t <= 0) {
//
// Send buffer, blocking
//
transport_.send(buf, true);
Assert._OB_assert(buf.is_full());
} else {
//
// Send buffer, with timeout
//
transport_.send_timeout(buf, t);
//
// Timeout?
//
if (!buf.is_full()) {
throw new org.omg.CORBA.NO_RESPONSE();
}
}
}
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
return true;
}
//
// a message should be sent by now so we have to
// mark it as sent for the GIOPClient
//
if (!msgSentMarked && (nextDown != null)
&& !nextDown.operation().equals("_locate")) {
msgSentMarked = true;
properties_ |= Property.RequestSent;
// debug
if (logger.isLoggable(Level.FINE)) {
int currentpos = buf.pos_;
buf.pos_ = 0;
logger.fine("Sent message in blocking at msgcount="
+ msgcount + ", size=" + buf.len_
+ ", the message piece is: \n" + buf.dumpData());
buf.pos_ = currentpos;
msgcount++;
}
}
}
} else // Non blocking
{
synchronized (this) {
int msgcount = 0;
while (true) {
if (!down.unsent())
break;
Assert._OB_assert(messageQueue_.hasUnsent());
//
// get the first message to send
//
org.apache.yoko.orb.OCI.Buffer buf = messageQueue_
.getFirstUnsentBuffer();
//
// send this buffer, non-blocking
//
try {
synchronized (sendMutex_) {
transport_.send(buf, false);
}
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
return true;
}
//
// if the buffer isn't full, it hasn't been sent because
// the call would have blocked.
//
if (!buf.is_full())
return false;
//
// now move to the pending pile
//
Downcall dummy = messageQueue_.moveFirstUnsentToPending();
//
// update the message sent property
//
if (!msgSentMarked && dummy != null) {
if (dummy.responseExpected()
&& dummy.operation().equals("_locate")) {
msgSentMarked = true;
properties_ |= Property.RequestSent;
// debug
if (logger.isLoggable(Level.FINE)) {
int currentpos = buf.pos_;
buf.pos_ = 0;
logger.fine("Sent message in non-blocking at msgcount="
+ msgcount
+ ", size="
+ buf.len_
+ ", the message piece is: \n"
+ buf.dumpData());
buf.pos_ = currentpos;
msgcount++;
}
}
}
}
}
}
logger.fine(" Request send completed with Downcall of type " + down.getClass().getName());
return !down.responseExpected();
}
//
// client-side receive method (from DowncallEmitter)
//
public boolean receive(Downcall down, boolean block) {
logger.fine("Receiving response with Downcall of type " + down.getClass().getName() + " for operation " + down.operation() + " from transport " + transport_);
//
// Try to receive the reply
//
try {
boolean result = down.waitUntilCompleted(block);
logger.fine("Completed receiving response with Downcall of type " + down.getClass().getName());
return result;
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
return true;
}
}
//
// client-side sendReceive (from DowncallEmitter)
//
public boolean sendReceive(Downcall down) {
ACM_disableIdleMonitor();
try {
if (send(down, true)) {
return true;
}
return receive(down, true);
} finally {
ACM_enableIdleMonitor();
}
}
//
// connection start (from GIOPConnection)
//
public void start() {
//
// unpause any paused threads
//
synchronized (holdingMonitor_) {
if (holding_) {
holding_ = false;
holdingMonitor_.notifyAll();
}
}
//
// check if we need to add a receiver thread
//
if (transport_.mode() != org.apache.yoko.orb.OCI.SendReceiveMode.SendOnly) {
try {
// If the write lock is obtainable there are no receivers outstanding.
// We can then add a receiver, which implicitly obtains a read lock.
// ReentrantReadWriteLock explicitly allows downgrading a write lock to a read lock.
if(receiverLock.writeLock().tryLock()) {
try {
addReceiverThread();
} finally {
receiverLock.writeLock().unlock();
}
}
} catch (OutOfMemoryError ex) {
synchronized (this) {
transport_.close();
state_ = State.Closed;
throw new org.omg.CORBA.IMP_LIMIT(org.apache.yoko.orb.OB.MinorCodes
.describeImpLimit(org.apache.yoko.orb.OB.MinorCodes.MinorThreadLimit),
org.apache.yoko.orb.OB.MinorCodes.MinorThreadLimit,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
}
}
//
// connection refresh status (from GIOPConnection)
//
public void refresh() {
boolean msgSentMarked = false;
//
// wake up any paused threads
//
synchronized (holdingMonitor_) {
if (holding_) {
holding_ = false;
holdingMonitor_.notifyAll();
}
}
synchronized (this) {
//
// if we can't write messages then don't bother to proceed
//
if ((enabledOps_ & AccessOp.Write) == 0)
return;
//
// check if we've sent a message before while we are locked
//
if ((properties_ & Property.RequestSent) != 0)
msgSentMarked = true;
}
//
// another check if we can write or not
//
if (transport_.mode() == org.apache.yoko.orb.OCI.SendReceiveMode.ReceiveOnly)
return;
//
// now send off any queued messages
//
while (true) {
org.apache.yoko.orb.OCI.Buffer buf;
Downcall dummy;
try {
synchronized (this) {
//
// stop when no messages left
//
if (!messageQueue_.hasUnsent())
break;
buf = messageQueue_.getFirstUnsentBuffer();
buf.pos(0);
dummy = messageQueue_.moveFirstUnsentToPending();
}
//
// make sure no two threads are sending at once
//
synchronized (sendMutex_) {
transport_.send(buf, true);
}
//
// check if the buffer is full
// Some of the OCI plugins (bidir for example) will
// simply return instead of throwing an exception if the
// send fails
//
if (!buf.is_full())
throw new org.omg.CORBA.COMM_FAILURE(org.apache.yoko.orb.OB.MinorCodes
.describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSend),
org.apache.yoko.orb.OB.MinorCodes.MinorSend,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
//
// mark the message sent flag
//
if (!msgSentMarked && (dummy != null)) {
if (dummy.responseExpected()
&& dummy.operation().equals("_locate")) {
synchronized (this) {
msgSentMarked = true;
properties_ |= Property.RequestSent;
}
}
}
} catch (org.omg.CORBA.SystemException ex) {
processException(State.Closed, ex, false);
return;
}
}
}
//
// connection pause (from GIOPConnection)
//
public void pause() {
synchronized (holdingMonitor_) {
holding_ = true;
}
}
//
// enabled connection 'sides' (from GIOPConnection)
//
public void enableConnectionModes(boolean client, boolean server) {
//
// do nothing
//
}
}
| 6,360 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/DispatchStrategyIdHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/DispatchStrategyId:1.0
//
final public class DispatchStrategyIdHelper
{
public static void
insert(org.omg.CORBA.Any any, int val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static int
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "DispatchStrategyId", orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong));
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/DispatchStrategyId:1.0";
}
public static int
read(org.omg.CORBA.portable.InputStream in)
{
int _ob_v;
_ob_v = in.read_ulong();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, int val)
{
out.write_ulong(val);
}
}
| 6,361 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/RETRY_STRICT.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/RETRY_STRICT:1.0
//
/**
*
* The <code>RETRY_STRICT</code> RetryPolicy value.
*
**/
public interface RETRY_STRICT
{
short value = (short)(1L);
}
| 6,362 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPOutgoingMessage.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class GIOPOutgoingMessage {
private static int maxMessageSize_ = 0; // TODO: pick a default
private ORBInstance orbInstance_;
private org.apache.yoko.orb.CORBA.OutputStream out_;
private org.apache.yoko.orb.OCI.ProfileInfo profileInfo_;
// ----------------------------------------------------------------------
// GIOPOutgoingMessage private and protected member implementations
// ----------------------------------------------------------------------
private void writeServiceContextList(org.omg.IOP.ServiceContext[] scl) {
int len = scl.length;
out_.write_ulong(len);
if (len > 0) {
for (int i = 0; i < len; i++) {
org.omg.IOP.ServiceContext sc = scl[i];
out_.write_ulong(sc.context_id);
int n = sc.context_data.length;
out_.write_ulong(n);
out_.write_octet_array(sc.context_data, 0, n);
}
}
}
private void writeTargetAddress(org.omg.GIOP.TargetAddress target) {
short disc = target.discriminator();
out_.write_short(disc);
switch (disc) {
case 0: // GIOP::KeyAddr
{
byte[] seq = target.object_key();
int len = seq.length;
out_.write_ulong(len);
if (len > 0)
out_.write_octet_array(seq, 0, len);
break;
}
case 1: // GIOP::ProfileAddr
{
org.omg.IOP.TaggedProfile profile = target.profile();
org.omg.IOP.TaggedProfileHelper.write(out_, profile);
break;
}
case 2: // GIOP::ReferenceAddr
{
org.omg.GIOP.IORAddressingInfo info = target.ior();
org.omg.GIOP.IORAddressingInfoHelper.write(out_, info);
break;
}
default:
Assert._OB_assert(false);
}
}
// ----------------------------------------------------------------------
// GIOPOutgoingMessage package member implementations
// ----------------------------------------------------------------------
GIOPOutgoingMessage(ORBInstance orbInstance,
org.apache.yoko.orb.CORBA.OutputStream out,
org.apache.yoko.orb.OCI.ProfileInfo profileInfo) {
orbInstance_ = orbInstance;
out_ = out;
profileInfo_ = profileInfo;
}
org.apache.yoko.orb.OCI.ProfileInfo profileInfo() {
return profileInfo_;
}
void writeMessageHeader(org.omg.GIOP.MsgType_1_1 type, boolean fragment,
int size) {
Assert._OB_assert(type.value() >= 0
&& type.value() <= org.omg.GIOP.MsgType_1_1._Fragment);
Assert
._OB_assert(!(profileInfo_.major == (byte) 1
&& profileInfo_.minor == (byte) 0 && (type.value() > org.omg.GIOP.MsgType_1_1._MessageError || fragment)));
if (maxMessageSize_ > 0 && size > maxMessageSize_) {
String msg = "outgoing message size (" + size
+ ") exceeds maximum (" + maxMessageSize_ + ")";
orbInstance_.getLogger().warning(msg);
throw new org.omg.CORBA.IMP_LIMIT(org.apache.yoko.orb.OB.MinorCodes
.describeImpLimit(org.apache.yoko.orb.OB.MinorCodes.MinorMessageSizeLimit),
org.apache.yoko.orb.OB.MinorCodes.MinorMessageSizeLimit,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
byte flags = 0;
// JVM is always big endian. jlint complains here, so skip this code
// boolean endian = false; // false means big endian
// if(endian)
// flags |= 0x01;
if (fragment)
flags |= 0x02;
final byte[] giop = { (byte) 'G', (byte) 'I', (byte) 'O', (byte) 'P' };
out_.write_octet_array(giop, 0, 4); // magic
out_.write_octet(profileInfo_.major); // GIOP_version.major
out_.write_octet(profileInfo_.minor); // GIOP_version.minor
out_.write_octet(flags); // flags
out_.write_octet((byte) type.value()); // message_type
out_.write_ulong(size); // message_size
}
void writeRequestHeader(int id, String op, boolean response,
org.omg.IOP.ServiceContext[] scl) {
switch (profileInfo_.minor) {
case 0:
case 1: {
writeServiceContextList(scl); // service_context
out_.write_ulong(id); // request_id
out_.write_boolean(response); // response_expected
//
// reserved
//
final byte[] reserved = { 0, 0, 0 };
out_.write_octet_array(reserved, 0, 3);
//
// object_key
//
int keyLen = profileInfo_.key.length;
out_.write_ulong(keyLen);
out_.write_octet_array(profileInfo_.key, 0, keyLen);
//
// operation (we use octets to avoid codeset conversion)
//
int opLen = op.length();
out_.write_ulong(opLen + 1);
out_.write_octet_array(op.getBytes(), 0, opLen);
out_.write_octet((byte) 0); // nul terminator
out_.write_ulong(0); // requesting_principal
break;
}
case 2: {
out_.write_ulong(id); // request_id
//
// response_flags
//
byte responseFlags = 0;
if (response)
responseFlags |= 0x3;
out_.write_octet(responseFlags);
//
// reserved
//
final byte[] reserved = { 0, 0, 0 };
out_.write_octet_array(reserved, 0, 3);
//
// target
//
out_.write_short(org.omg.GIOP.KeyAddr.value);
int keyLen = profileInfo_.key.length;
out_.write_ulong(keyLen);
out_.write_octet_array(profileInfo_.key, 0, keyLen);
//
// operation (we use octets to avoid codeset conversion)
//
int opLen = op.length();
out_.write_ulong(opLen + 1);
out_.write_octet_array(op.getBytes(), 0, opLen);
out_.write_octet((byte) 0); // nul terminator
writeServiceContextList(scl); // service_context
//
// For GIOP 1.2, the body (if any) must be aligned on an 8-octet
// boundary, so we notify the OutputStream that it should align
// the next write
//
out_._OB_alignNext(8);
break;
}
default:
Assert._OB_assert(false);
}
}
void writeReplyHeader(int id, org.omg.GIOP.ReplyStatusType_1_2 status,
org.omg.IOP.ServiceContext[] scl) {
switch (profileInfo_.minor) {
case 0:
case 1: {
Assert
._OB_assert(status.value() <= org.omg.GIOP.ReplyStatusType_1_2._LOCATION_FORWARD);
writeServiceContextList(scl); // service_context
out_.write_ulong(id); // request_id
out_.write_ulong(status.value()); // reply_status
break;
}
case 2: {
out_.write_ulong(id); // request_id
out_.write_ulong(status.value()); // reply_status
writeServiceContextList(scl); // service_context
//
// For GIOP 1.2, the body (if any) must be aligned on an 8-octet
// boundary, so we notify the OutputStream that it should align
// the next write
//
out_._OB_alignNext(8);
break;
}
default:
Assert._OB_assert(false);
}
}
void writeCancelRequestHeader(int id) {
out_.write_ulong(id); // request_id
}
// Not currently used
void writeLocateRequestHeader(int id) {
switch (profileInfo_.minor) {
case 0:
case 1: {
out_.write_ulong(id); // request_id
//
// object_key
//
int keyLen = profileInfo_.key.length;
out_.write_ulong(keyLen);
out_.write_octet_array(profileInfo_.key, 0, keyLen);
break;
}
case 2: {
out_.write_ulong(id); // request_id
//
// target
//
out_.write_short(org.omg.GIOP.KeyAddr.value);
int keyLen = profileInfo_.key.length;
out_.write_ulong(keyLen);
out_.write_octet_array(profileInfo_.key, 0, keyLen);
break;
}
default:
Assert._OB_assert(false);
}
}
// Not currently used
void writeLocateReplyHeader(int id, org.omg.GIOP.LocateStatusType_1_2 status) {
switch (profileInfo_.minor) {
case 0:
case 1: {
Assert
._OB_assert(status.value() <= org.omg.GIOP.LocateStatusType_1_2._OBJECT_FORWARD);
out_.write_ulong(id); // request_id
out_.write_ulong(status.value()); // locate_status
break;
}
case 2: {
out_.write_ulong(id); // request_id
out_.write_ulong(status.value()); // locate_status
//
// Do NOT align a locate reply body on an 8-octet boundary
//
break;
}
default:
Assert._OB_assert(false);
}
}
// Currently not used
void writeFragmentHeader(int id) {
Assert
._OB_assert(!(profileInfo_.major == 1 && profileInfo_.minor <= 1));
out_.write_ulong(id); // request_id
//
// TODO: Possibly need to align on 8-octet boundary in GIOP 1.2
// (see Interop issue #2521)
//
}
// ----------------------------------------------------------------------
// GIOPOutgoingMessage public member implementations
// ----------------------------------------------------------------------
public static void setMaxMessageSize(int max) {
maxMessageSize_ = max;
}
}
| 6,363 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ZeroPortPolicyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/ZeroPortPolicy:1.0
//
/**
*
* The connection reuse policy. This policy determines whether
* connections may be reused or are private to specific objects.
*
**/
public interface ZeroPortPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:orb.yoko.apache.org/OB/ZeroPortPolicy/value:1.0
//
/**
*
* If an object has a <code>ZeroPortPolicy</code> set with
* <code>value</code> set to <code>TRUE</code>, then the IOR
* will have a zero value encoded in the IIOP profile.
*
**/
boolean value();
}
| 6,364 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocationTransparencyPolicyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocationTransparencyPolicy:1.0
//
final public class LocationTransparencyPolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, LocationTransparencyPolicy val)
{
any.insert_Object(val, type());
}
public static LocationTransparencyPolicy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "LocationTransparencyPolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/LocationTransparencyPolicy:1.0";
}
public static LocationTransparencyPolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, LocationTransparencyPolicy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static LocationTransparencyPolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (LocationTransparencyPolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,365 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocProtocol.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/CorbalocProtocol:1.0
//
/**
*
* The <code>corbaloc</code> URL scheme supports multiple protocols,
* the most common of which is <code>iiop</code>. The CorbalocURLScheme
* delegates the parsing of protocol address information to a
* registered CorbalocProtocol object.
*
* @see CorbalocURLScheme
*
**/
public interface CorbalocProtocol extends CorbalocProtocolOperations,
org.omg.CORBA.Object
{
}
| 6,366 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetReader.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public abstract class CodeSetReader {
public final static int L_ENDIAN = 1;
public final static int FIRST_CHAR = 2;
abstract char read_char(org.apache.yoko.orb.CORBA.InputStream in)
throws org.omg.CORBA.DATA_CONVERSION;
abstract char read_wchar(org.apache.yoko.orb.CORBA.InputStream in, int len)
throws org.omg.CORBA.DATA_CONVERSION;
abstract int count_wchar(char value);
abstract void set_flags(int flags);
}
| 6,367 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/TimeoutPolicyHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/TimeoutPolicy:1.0
//
final public class TimeoutPolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, TimeoutPolicy val)
{
any.insert_Object(val, type());
}
public static TimeoutPolicy
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION(
org.apache.yoko.orb.OB.MinorCodes
.describeBadOperation(org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "TimeoutPolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:orb.yoko.apache.org/OB/TimeoutPolicy:1.0";
}
public static TimeoutPolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorReadUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TimeoutPolicy val)
{
throw new org.omg.CORBA.MARSHAL(
org.apache.yoko.orb.OB.MinorCodes
.describeMarshal(org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported),
org.apache.yoko.orb.OB.MinorCodes.MinorWriteUnsupported,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public static TimeoutPolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (TimeoutPolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompatibleObjectType,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,368 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetDatabase.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class CodeSetDatabase {
//
// The codeset registry IDs for the supported codesets
//
public final static int ISOLATIN1 = 0x00010001;
public final static int ISOLATIN2 = 0x00010002;
public final static int ISOLATIN3 = 0x00010003;
public final static int ISOLATIN4 = 0x00010004;
public final static int ISOLATIN5 = 0x00010005;
public final static int ISOLATIN7 = 0x00010007;
public final static int ISOLATIN9 = 0x00010009;
public final static int PCS = 0x00010020;
public final static int UTF8 = 0x05010001;
public final static int UTF16 = 0x00010109;
public final static int UCS2 = 0x00010100;
//
// The CodeSetDatabase singleton
//
private static CodeSetDatabase instance_;
//
// Initialize database
//
private static CharMapDatabaseInit database_ = new CharMapDatabaseInit();
protected void finalize() throws Throwable {
super.finalize();
}
static public CodeSetDatabase instance() {
if (instance_ == null) {
instance_ = new CodeSetDatabase();
//
// Add locale specific char codesets
//
String locale = java.util.Locale.getDefault().getLanguage();
if (locale.equals("C") || locale.equals("POSIX")) {
CodeSetUtil.addCharCodeSet(ISOLATIN1);
} else {
String loc = locale.substring(0, 2);
//
// West European (C, POSIX, Germany, England, France,
// Netherlands, Portugal)
//
if (loc.equals("de") || loc.equals("en") || loc.equals("fr")
|| loc.equals("nl") || loc.equals("pt")) {
CodeSetUtil.addCharCodeSet(ISOLATIN1);
}
//
// North European (Denmark, Finland, Island, Norway, Sweden)
//
else if (loc.equals("da") || loc.equals("fi")
|| loc.equals("is") || loc.equals("no")
|| loc.equals("sv")) {
CodeSetUtil.addCharCodeSet(ISOLATIN4);
}
//
// South European (Italy)
//
else if (loc.equals("it")) {
CodeSetUtil.addCharCodeSet(ISOLATIN3);
}
//
// East European (Czek, Hungary, Poland, Slovakia, Slovenia)
//
else if (loc.equals("cs") || loc.equals("hu")
|| loc.equals("pl") || loc.equals("sk")
|| loc.equals("sl")) {
CodeSetUtil.addCharCodeSet(ISOLATIN2);
}
//
// Greek (Greece)
//
else if (loc.equals("el")) {
CodeSetUtil.addCharCodeSet(ISOLATIN7);
}
//
// Cyrillic (Russia)
//
else if (loc.equals("ru")) {
CodeSetUtil.addCharCodeSet(ISOLATIN5);
}
//
// Turkish (Turkey)
//
else if (loc.equals("tr")) {
CodeSetUtil.addCharCodeSet(ISOLATIN9);
}
}
//
// Always supported
//
CodeSetUtil.addCharCodeSet(PCS);
//
// Always supported, but only as transmission codeset
//
CodeSetUtil.addCharCodeSet(UTF8);
//
// Add the supported wchar codesets in the preferred order
//
CodeSetUtil.addWcharCodeSet(UTF16);
}
return instance_;
}
synchronized public CodeConverterBase getConverter(int to, int from) {
CodeSetInfo toSet = getCodeSetInfo(to);
CodeSetInfo fromSet = getCodeSetInfo(from);
if (toSet != null && fromSet != null) {
if (toSet.max_bytes == 1) {
//
// Optimization: Don't use converter for identical
// narrow codesets
//
if (to == from)
return null;
}
}
CodeConverterBase converter = null;
//
// Conversion possible at all?
//
if (fromSet == null || toSet == null) {
converter = new CodeConverterNone(fromSet, toSet);
} else {
//
// Shortcut for UTF-16 / UCS-2, and UTF-8 / ISOLATIN1
//
if ((toSet.rgy_value == UTF16 || toSet.rgy_value == UCS2)
&& (fromSet.rgy_value == UTF16 || fromSet.rgy_value == UCS2)) {
converter = new CodeConverterSimple(fromSet, toSet);
} else if (((toSet.rgy_value == UTF8 || toSet.rgy_value == ISOLATIN1) && fromSet.rgy_value == UTF8)
|| (toSet.rgy_value == UTF8 && fromSet.rgy_value == ISOLATIN1)) {
converter = new CodeConverterSimple(fromSet, toSet);
} else {
//
// Create new converter and add it to the converter list.
// No conversion to/from ISOLATIN1 and to/from UCS2.
//
CharMapInfo fromMap = null;
CharMapInfo toMap = null;
int fromBase = fromSet.max_bytes == 1 ? ISOLATIN1 : UTF16;
if (fromSet.rgy_value != fromBase)
fromMap = getCharMapInfo(fromSet.rgy_value);
int toBase = toSet.max_bytes == 1 ? ISOLATIN1 : UTF16;
if (toSet.rgy_value != toBase)
toMap = getCharMapInfo(toSet.rgy_value);
if (fromMap != null && toMap != null) {
converter = new CodeConverterBoth(fromSet, toSet, fromMap,
toMap);
} else if (fromMap != null) {
converter = new CodeConverterFrom(fromSet, toSet, fromMap);
} else if (toMap != null) {
converter = new CodeConverterTo(fromSet, toSet, toMap);
} else {
Assert._OB_assert(false);
}
}
}
return converter;
}
public CodeSetInfo getCodeSetInfo(int rgy_value) {
//
// Check if codeset id is listed in registry
//
for (int i = 0; i < CodeSetDatabaseInit.codeSetInfoArraySize_; i++)
if (CodeSetDatabaseInit.codeSetInfoArray_[i].rgy_value == rgy_value)
return CodeSetDatabaseInit.codeSetInfoArray_[i];
return null;
}
int determineTCS(org.omg.CONV_FRAME.CodeSetComponent clientCS,
org.omg.CONV_FRAME.CodeSetComponent serverCS, int fallback) {
//
// Check if native codesets are present
//
if (clientCS.native_code_set != 0 && serverCS.native_code_set != 0) {
//
// Check if the native codesets are identical
// In case they are no conversion is required
//
if (clientCS.native_code_set == serverCS.native_code_set)
return serverCS.native_code_set;
//
// Check if client can convert
//
if (checkCodeSetId(clientCS, serverCS.native_code_set))
return serverCS.native_code_set;
//
// Check if server can convert
//
if (checkCodeSetId(serverCS, clientCS.native_code_set))
return clientCS.native_code_set;
}
//
// Check for common codeset that can be used for transmission
// The server supported codesets have preference
//
for (int i = 0; i < serverCS.conversion_code_sets.length; i++) {
if (checkCodeSetId(clientCS, serverCS.conversion_code_sets[i]))
return serverCS.conversion_code_sets[i];
}
if (clientCS.native_code_set != 0 && serverCS.native_code_set != 0) {
//
// Check compatibility by using the OSF registry,
// use fallback codeset if compatible
//
if (isCompatible(clientCS.native_code_set, serverCS.native_code_set))
return fallback;
}
throw new org.omg.CORBA.CODESET_INCOMPATIBLE();
}
private boolean isCompatible(int id1, int id2) {
CodeSetInfo cs1 = getCodeSetInfo(id1);
CodeSetInfo cs2 = getCodeSetInfo(id2);
if (cs1 == null || cs2 == null)
return false;
for (int i = 0; i < cs1.char_values_size; i++) {
for (int j = 0; j < cs2.char_values_size; j++) {
//
// In order to be compatible in OSF terms, two codesets
// must have a common character set
//
if (cs1.char_values[i] == cs2.char_values[j])
return true;
}
}
return false;
}
private boolean checkCodeSetId(org.omg.CONV_FRAME.CodeSetComponent cs,
int id) {
for (int i = 0; i < cs.conversion_code_sets.length; i++) {
if (cs.conversion_code_sets[i] == id)
return true;
}
//
// ID not found
//
return false;
}
public int nameToId(String name) {
org.apache.yoko.orb.OB.Assert._OB_assert(name != null);
//
// Check if codeset name is listed in registry
// Return first match so that shortcuts can be used
//
for (int i = 0; i < CodeSetDatabaseInit.codeSetInfoArraySize_; i++) {
String s = CodeSetDatabaseInit.codeSetInfoArray_[i].description;
if (s.indexOf(name) != -1)
return CodeSetDatabaseInit.codeSetInfoArray_[i].rgy_value;
}
//
// Name not found
//
return 0;
}
private CharMapInfo getCharMapInfo(int rgy_value) {
String name = "";
switch (rgy_value) {
case ISOLATIN1:
name = "ISO/IEC 8859-1:1998 to Unicode";
break;
case ISOLATIN2:
name = "ISO 8859-2:1999 to Unicode";
break;
case ISOLATIN3:
name = "ISO/IEC 8859-3:1999 to Unicode";
break;
case ISOLATIN4:
name = "ISO/IEC 8859-4:1998 to Unicode";
break;
case ISOLATIN5:
name = "ISO 8859-5:1999 to Unicode";
break;
case ISOLATIN7:
name = "ISO 8859-7:1987 to Unicode";
break;
case ISOLATIN9:
name = "ISO/IEC 8859-9:1999 to Unicode";
break;
case PCS:
name = "PCS to Unicode";
break;
default:
break;
}
for (int i = 0; i < CharMapDatabaseInit.charMapInfoArraySize_; i++) {
if (CharMapDatabaseInit.charMapInfoArray_[i].name.equals(name))
return CharMapDatabaseInit.charMapInfoArray_[i];
}
return null;
}
}
| 6,369 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ProtocolPolicy_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.PROTOCOL_POLICY_ID;
import org.apache.yoko.orb.OB.ProtocolPolicy;
final public class ProtocolPolicy_impl extends org.omg.CORBA.LocalObject
implements ProtocolPolicy {
private String[] value_;
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public String[] value() {
return value_;
}
public boolean contains(String id) {
for (int i = 0; i < value_.length; i++)
if (id.equals(value_[i]))
return true;
return false;
}
public int policy_type() {
return PROTOCOL_POLICY_ID.value;
}
public org.omg.CORBA.Policy copy() {
return this;
}
public void destroy() {
}
// ------------------------------------------------------------------
// Yoko internal functions
// Application programs must not use these functions directly
// ------------------------------------------------------------------
public ProtocolPolicy_impl(String[] value) {
value_ = value;
}
}
| 6,370 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Logger_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Logger_impl implements org.apache.yoko.orb.OB.Logger {
// the real logger backing instance.
static final Logger logger = Logger.getLogger(ORBInstance.class.getName());
public void info(String msg) {
logger.info(msg);
}
public void info(String msg, Throwable e) {
logger.log(Level.INFO, msg, e);
}
public void error(String msg) {
logger.severe(msg);
}
public void error(String msg, Throwable e) {
logger.log(Level.SEVERE, msg, e);
}
public void warning(String msg) {
logger.warning(msg);
}
public void warning(String msg, Throwable e) {
logger.log(Level.WARNING, msg, e);
}
public void debug(String msg) {
logger.fine(msg);
}
public void debug(String msg, Throwable e) {
logger.log(Level.FINE, msg, e);
}
public boolean isDebugEnabled() {
return logger.isLoggable(Level.FINE);
}
public void trace(String category, String msg) {
logger.log(Level.FINE, category, msg);
String s = "[ " + category + ": ";
int start = 0;
int next;
while ((next = msg.indexOf('\n', start)) != -1) {
s += msg.substring(start, next + 1);
s += " ";
start = next + 1;
}
s += msg.substring(start);
s += " ]";
logger.log(Level.FINE, msg);
}
/**
* Log a message of the indicated level.
*
* @param level The message level.
* @param msg The logged message.
*/
public void log(Level level, String msg) {
logger.log(level, msg);
}
/**
* Log a message of the indicated level.
*
* @param level The message level.
* @param msg The logged message.
* @param param A single parameter object included with the message.
*/
public void log(Level level, String msg, Object param) {
logger.log(level, msg, param);
}
/**
* Log a message of the indicated level.
*
* @param level The message level.
* @param msg The logged message.
* @param params An array of parameter objects logged with the message.
*/
public void log(Level level, String msg, Object[] params) {
logger.log(level, msg, params);
}
/**
* Log a message of the indicated level.
*
* @param level The message level.
* @param msg The logged message.
* @param thrown An exception object included in the log.
*/
public void log(Level level, String msg, Throwable thrown) {
logger.log(level, msg, thrown);
}
}
| 6,371 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootManager_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.yoko.orb.OB.BootLocator;
import org.apache.yoko.orb.OB.BootManager;
import org.omg.CORBA.ORB;
import org.omg.CORBA.ORBPackage.InvalidName;
final public class BootManager_impl extends org.omg.CORBA.LocalObject implements
BootManager {
static final Logger logger = Logger.getLogger(BootManager_impl.class.getName());
//
// Set of known bindings
//
private java.util.Hashtable bindings_;
//
// The Boot Locator. There is no need for the BootLocatorHolder
// since assign and read methods are atomic in Java.
//
private BootLocator locator_ = null;
// the ORB that created us
private ORB orb_;
public BootManager_impl(ORB orb) {
bindings_ = new java.util.Hashtable(17);
orb_ = orb;
}
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public void add_binding(byte[] id, org.omg.CORBA.Object obj)
throws org.apache.yoko.orb.OB.BootManagerPackage.AlreadyExists {
ObjectIdHasher oid = new ObjectIdHasher(id);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Adding binding under id " + IORUtil.dump_octets(id));
}
//
// If binding id is not already mapped add the binding.
//
synchronized (bindings_) {
if (bindings_.containsKey(oid))
throw new org.apache.yoko.orb.OB.BootManagerPackage.AlreadyExists();
bindings_.put(oid, obj);
}
}
public void remove_binding(byte[] id)
throws org.apache.yoko.orb.OB.BootManagerPackage.NotFound {
ObjectIdHasher oid = new ObjectIdHasher(id);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Removing binding with id " + IORUtil.dump_octets(id));
}
//
// If binding id is mapped remove the binding
//
synchronized (bindings_) {
if (bindings_.remove(oid) == null)
throw new org.apache.yoko.orb.OB.BootManagerPackage.NotFound();
}
}
public void set_locator(BootLocator locator) {
//
// Set the BootLocator
//
locator_ = locator;
}
// -------------------------------------------------------------------
// BootManager_impl internal methods
// ------------------------------------------------------------------
public org.omg.IOP.IOR _OB_locate(byte[] id) {
//
// First check the internal hash table and then the
// registered BootLocator (if there is one) to find the
// binding for the requested ObjectId.
//
ObjectIdHasher oid = new ObjectIdHasher(id);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Searching for binding with id " + IORUtil.dump_octets(id));
}
org.omg.CORBA.Object obj = (org.omg.CORBA.Object) bindings_.get(oid);
if (obj == null && locator_ != null) {
logger.fine("Object not found, passing on to locator");
try {
org.omg.CORBA.ObjectHolder objHolder = new org.omg.CORBA.ObjectHolder();
org.omg.CORBA.BooleanHolder addHolder = new org.omg.CORBA.BooleanHolder();
locator_.locate(id, objHolder, addHolder);
obj = objHolder.value;
if (addHolder.value) {
bindings_.put(oid, obj);
}
} catch (org.apache.yoko.orb.OB.BootManagerPackage.NotFound ex) {
}
}
if (obj == null) {
// these should map to initial references as well when used as a corbaloc name.
// convert the key to a string and try for one of those
String keyString = new String(id);
try {
obj = orb_.resolve_initial_references(keyString);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
// if this is not valid, it won't work
return null;
}
// just return null if still not there
if (obj == null) {
return null;
}
}
org.apache.yoko.orb.CORBA.Delegate p = (org.apache.yoko.orb.CORBA.Delegate) (((org.omg.CORBA.portable.ObjectImpl) obj)
._get_delegate());
return p._OB_IOR();
}
}
| 6,372 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/AssertionFailed.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class AssertionFailed extends RuntimeException {
public AssertionFailed() {
super("Yoko encountered an internal error");
}
public AssertionFailed(String reason) {
super("Yoko encountered an internal error " + reason);
}
public AssertionFailed(Throwable ex) {
super("Yoko encountered an internal error", ex);
}
public AssertionFailed(String reason, Throwable ex) {
super("Yoko encountered an internal error " + reason, ex);
}
}
| 6,373 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UpcallReturn.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public interface UpcallReturn {
//
// Called upon return of the upcall
//
void upcallBeginReply(Upcall upcall, org.omg.IOP.ServiceContext[] scl);
void upcallEndReply(Upcall upcall);
void upcallBeginUserException(Upcall upcall,
org.omg.IOP.ServiceContext[] scl);
void upcallEndUserException(Upcall upcall);
void upcallUserException(Upcall upcall, org.omg.CORBA.UserException ex,
org.omg.IOP.ServiceContext[] scl);
void upcallSystemException(Upcall upcall,
org.omg.CORBA.SystemException exception,
org.omg.IOP.ServiceContext[] scl);
void upcallForward(Upcall upcall, org.omg.IOP.IOR ior, boolean perm,
org.omg.IOP.ServiceContext[] scl);
boolean replySent();
}
| 6,374 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbanameURLScheme_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import static org.apache.yoko.orb.OB.MinorCodes.MinorOther;
import static org.omg.CORBA.CompletionStatus.COMPLETED_NO;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.apache.yoko.orb.OB.CorbalocURLScheme;
import org.apache.yoko.orb.OB.CorbalocURLSchemeHelper;
import org.apache.yoko.orb.OB.URLRegistry;
import org.apache.yoko.orb.OB.URLScheme;
import org.omg.CORBA.BAD_PARAM;
public class CorbanameURLScheme_impl extends org.omg.CORBA.LocalObject
implements URLScheme {
private org.omg.CORBA.ORB orb_;
private CorbalocURLScheme corbaloc_;
// ------------------------------------------------------------------
// CorbanameURLScheme_impl constructor
// ------------------------------------------------------------------
public CorbanameURLScheme_impl(org.omg.CORBA.ORB orb, URLRegistry registry) {
orb_ = orb;
URLScheme scheme = registry.find_scheme("corbaloc");
Assert._OB_assert(scheme != null);
corbaloc_ = CorbalocURLSchemeHelper.narrow(scheme);
Assert._OB_assert(corbaloc_ != null);
}
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public String name() {
return "corbaname";
}
public org.omg.CORBA.Object parse_url(String url) {
//
// Get the object key
//
String keyStr;
int slash = url.indexOf('/');
int fragmentStart = url.indexOf('#');
if (slash != -1 && fragmentStart == -1) {
//
// e.g., corbaname::localhost:5000/blah
//
keyStr = url.substring(slash + 1);
} else if (slash == -1 || fragmentStart - 1 == slash
|| fragmentStart < slash) {
//
// e.g., corbaname::localhost:5000
// corbaname::localhost:5000/#foo
// corbaname::localhost:5000#foo/bar
//
keyStr = "NameService";
} else {
keyStr = url.substring(slash + 1, fragmentStart);
}
//
// Get start and end of protocol address(es)
//
int addrStart = 10; // skip "corbaname:"
int addrEnd;
if (addrStart == slash)
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress)
+ ": no protocol address", org.apache.yoko.orb.OB.MinorCodes.MinorBadAddress,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
if (slash == -1 && fragmentStart == -1)
addrEnd = url.length() - 1;
else if ((slash != -1 && fragmentStart == -1)
|| (slash != -1 && fragmentStart != -1 && slash < fragmentStart))
addrEnd = slash - 1;
else
addrEnd = fragmentStart - 1;
//
// Create a corbaloc URL
//
String corbaloc = "corbaloc:" + url.substring(addrStart, addrEnd + 1)
+ "/" + keyStr;
//
// Create object reference from the naming context
//
org.omg.CORBA.Object nc = corbaloc_.parse_url(corbaloc);
//
// If there is no URL fragment "#.....", or the stringified
// name is empty, then the URL refers to the naming context
// itself
//
if (fragmentStart == -1 || url.substring(fragmentStart).length() == 0)
return nc;
//
// Make a DII invocation on the Naming Service to resolve the
// specified context
//
Exception failureCause;
try {
//
// Create typecodes for Name and NameComponent
//
org.omg.CORBA.StructMember[] contents = new org.omg.CORBA.StructMember[2];
contents[0] = new org.omg.CORBA.StructMember();
contents[0].name = "id";
contents[0].type = TypeCodeFactory.createStringTC(0);
contents[1] = new org.omg.CORBA.StructMember();
contents[1].name = "kind";
contents[1].type = TypeCodeFactory.createStringTC(0);
org.omg.CORBA.TypeCode tcNameComponent = TypeCodeFactory
.createStructTC("IDL:omg.org/CosNaming/NameComponent:1.0",
"NameComponent", contents);
org.omg.CORBA.TypeCode tcName = TypeCodeFactory.createSequenceTC(0,
tcNameComponent);
//
// Parse path (remove URL escapes first) and create
// NameComponent sequence
//
String fragment = URLUtil.unescapeURL(url
.substring(fragmentStart + 1));
CORBANameParser parser = new CORBANameParser(fragment);
if (!parser.isValid())
throw new org.omg.CORBA.BAD_PARAM(
MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart)
+ ": invalid stringified name \"" + fragment + "\"",
org.apache.yoko.orb.OB.MinorCodes.MinorBadSchemeSpecificPart,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
String[] content = parser.getContents();
Assert._OB_assert((content.length % 2) == 0);
org.omg.CORBA.Object factoryObj = orb_
.resolve_initial_references("DynAnyFactory");
org.omg.DynamicAny.DynAnyFactory dynAnyFactory = org.omg.DynamicAny.DynAnyFactoryHelper
.narrow(factoryObj);
org.omg.CORBA.Any[] as = new org.omg.CORBA.Any[content.length / 2];
for (int i = 0; i < content.length; i += 2) {
//
// Create the DynStruct containing the id and kind fields
//
org.omg.DynamicAny.DynAny dynAny = dynAnyFactory
.create_dyn_any_from_type_code(tcNameComponent);
org.omg.DynamicAny.DynStruct name = org.omg.DynamicAny.DynStructHelper
.narrow(dynAny);
name.insert_string(content[i]);
name.next();
name.insert_string(content[i + 1]);
org.omg.CORBA.Any nany = name.to_any();
name.destroy();
as[i / 2] = nany;
}
//
// Create the Name
//
org.omg.DynamicAny.DynAny dynAny = dynAnyFactory
.create_dyn_any_from_type_code(tcName);
org.omg.DynamicAny.DynSequence seq = org.omg.DynamicAny.DynSequenceHelper
.narrow(dynAny);
seq.set_length(as.length);
seq.set_elements(as);
org.omg.CORBA.Any any = seq.to_any();
seq.destroy();
//
// Create the DII request
//
org.omg.CORBA.Request request = nc._request("resolve");
//
// Copy in the arguments
//
org.omg.CORBA.Any arg = request.add_in_arg();
arg.read_value(any.create_input_stream(), any.type());
request.set_return_type(TypeCodeFactory
.createPrimitiveTC(org.omg.CORBA.TCKind.tk_objref));
//
// Invoke the request
//
request.invoke();
//
// Return the result if there was no exception
//
failureCause = request.env().exception();
if (failureCause == null)
return request.return_value().extract_Object();
} catch (org.omg.CORBA.SystemException ex) {
failureCause = ex;
// Fall through
} catch (org.omg.CORBA.UserException ex) {
failureCause = ex;
// Fall through
}
final BAD_PARAM bp = new BAD_PARAM(MinorCodes.describeBadParam(MinorOther)
+ ": corbaname evaluation error:" + failureCause.getMessage(), MinorOther,
COMPLETED_NO);
throw (BAD_PARAM)bp.initCause(failureCause);
}
public void destroy() {
orb_ = null;
}
}
| 6,375 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CorbalocURLScheme.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/CorbalocURLScheme:1.0
//
/**
*
* CorbalocURLScheme implements the <code>corbaloc</code> URL scheme,
* and serves as a registry for CorbalocProtocol objects.
*
* @see CorbalocProtocol
*
**/
public interface CorbalocURLScheme extends CorbalocURLSchemeOperations,
URLScheme
{
}
| 6,376 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocationTransparencyPolicy.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocationTransparencyPolicy:1.0
//
/**
*
* The location transparency policy. This policy is used to control
* how strict the ORB is in enforcing location transparency. This is
* useful for performance reasons.
*
**/
public interface LocationTransparencyPolicy extends LocationTransparencyPolicyOperations,
org.omg.CORBA.Policy
{
}
| 6,377 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocationTransparencyPolicyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LocationTransparencyPolicy:1.0
//
final public class LocationTransparencyPolicyHolder implements org.omg.CORBA.portable.Streamable
{
public LocationTransparencyPolicy value;
public
LocationTransparencyPolicyHolder()
{
}
public
LocationTransparencyPolicyHolder(LocationTransparencyPolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = LocationTransparencyPolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
LocationTransparencyPolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return LocationTransparencyPolicyHelper.type();
}
}
| 6,378 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/TimeoutPolicy_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.TIMEOUT_POLICY_ID;
import org.apache.yoko.orb.OB.TimeoutPolicy;
final public class TimeoutPolicy_impl extends org.omg.CORBA.LocalObject
implements TimeoutPolicy {
private int value_;
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public int value() {
return value_;
}
public int policy_type() {
return TIMEOUT_POLICY_ID.value;
}
public org.omg.CORBA.Policy copy() {
return this;
}
public void destroy() {
}
// ------------------------------------------------------------------
// Yoko internal functions
// Application programs must not use these functions directly
// ------------------------------------------------------------------
public TimeoutPolicy_impl(int t) {
if (t < 0)
throw new org.omg.CORBA.IMP_LIMIT("Invalid value for "
+ "TimeoutPolicy");
value_ = t;
}
}
| 6,379 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/PIArgsDowncall.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
public class PIArgsDowncall extends PIDowncall {
//
// Argument, result and exception list description provided by the
// static stubs
//
protected ParameterDesc[] argDesc_;
protected ParameterDesc retDesc_;
protected org.omg.CORBA.TypeCode[] exceptionTC_;
// ----------------------------------------------------------------------
// PIArgsDowncall private and protected member implementations
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// PIArgsDowncall public member implementations
// ----------------------------------------------------------------------
public PIArgsDowncall(ORBInstance orbInstance, Client client,
org.apache.yoko.orb.OCI.ProfileInfo profileInfo,
RefCountPolicyList policies, String op, boolean resp,
org.omg.IOP.IOR IOR, org.omg.IOP.IOR origIOR,
/**/PIManager piManager, ParameterDesc[] argDesc,
ParameterDesc retDesc, org.omg.CORBA.TypeCode[] exceptionTC) {
super(orbInstance, client, profileInfo, policies, op, resp, IOR,
origIOR, piManager);
argDesc_ = argDesc;
retDesc_ = retDesc;
exceptionTC_ = exceptionTC;
}
public org.apache.yoko.orb.CORBA.OutputStream preMarshal()
throws LocationForward, FailureException {
requestInfo_ = piManager_.clientSendRequest(op_, responseExpected_,
IOR_, origIOR_, profileInfo_, policies_.value, requestSCL_,
replySCL_, argDesc_, retDesc_, exceptionTC_);
return preMarshalBase(); // Equivalent to Downcall::preMarshal()
}
}
| 6,380 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/UnknownExceptionInfo.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/UnknownExceptionInfo:1.0
//
/**
*
* Information about the context in which the unknown exception occurred.
*
**/
public interface UnknownExceptionInfo extends UnknownExceptionInfoOperations,
org.omg.CORBA.Object
{
}
| 6,381 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/TimeHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.omg.CORBA.*;
import org.omg.TimeBase.*;
//
// This is a simpler set of functions to work with TimeBase::UtcT, and
// TimeBase::TimeT values.
//
// The Time Service uses units of 100 nanoseconds and a base time
// of 15 October 1582 00:00:00.
//
public class TimeHelper {
//
// 100 nanoseconds = 10^-7 seconds and 1 millisecond = 10^-3 seconds,
// hence there are 10^4 (10,000) milliseconds per 100 nanoseconds.
//
private final static long HNanosPerMilli = 10000L;
//
// 100 ns units from 15 October 1582 00:00:00 to 1 January 1970 00:00:00.
//
// Time difference in 100 ns units between DCE and POSIX time base.
// 141427 days with 86400 seconds each.
//
private final static long DCEToPosix = 141427L * 86400L * HNanosPerMilli * 1000;
//
// Max TimeT value
//
public final static long MaxTimeT = 0xffffffffffffffffL;
//
// Max InaccuracyT value
//
public final static long MaxInaccuracyT = 0xffffffffffffL;
public static UtcT utcNow(long inaccuracy) {
if (Unsigned.gt(inaccuracy, MaxInaccuracyT))
throw new BAD_PARAM();
long time = Unsigned.add(Unsigned.multiply(System.currentTimeMillis(),
HNanosPerMilli), DCEToPosix);
java.util.Calendar cal = java.util.Calendar.getInstance();
int offset = cal.get(java.util.Calendar.ZONE_OFFSET)
+ cal.get(java.util.Calendar.DST_OFFSET);
return toUtcT(time, inaccuracy, (short) (offset / 60000));
}
public static UtcT utcMin() {
java.util.Calendar cal = java.util.Calendar.getInstance();
int offset = cal.get(java.util.Calendar.ZONE_OFFSET)
+ cal.get(java.util.Calendar.DST_OFFSET);
return toUtcT(0, 0, (short) (offset / 60000));
}
public static UtcT utcMax() {
java.util.Calendar cal = java.util.Calendar.getInstance();
int offset = cal.get(java.util.Calendar.ZONE_OFFSET)
+ cal.get(java.util.Calendar.DST_OFFSET);
return toUtcT(MaxTimeT, 0, (short) (offset / 60000));
}
public static long toJavaMillis(UtcT utc) {
return toJavaMillis(utc.time);
}
public static long toJavaMillis(long time) {
if (Unsigned.lt(time, DCEToPosix))
return 0;
return Unsigned.divide(Unsigned.subtract(time, DCEToPosix),
HNanosPerMilli);
}
public static IntervalT toIntervalT(long time, long inaccuracy) {
IntervalT inter = new IntervalT();
if (Unsigned.lt(time, inaccuracy))
inter.lower_bound = 0;
else
inter.lower_bound = Unsigned.subtract(time, inaccuracy);
if (Unsigned.lt(Unsigned.subtract(MaxTimeT, time), inaccuracy))
inter.upper_bound = MaxTimeT;
else
inter.upper_bound = Unsigned.add(time, inaccuracy);
return inter;
}
public static UtcT toUtcT(long time, long inaccuracy, short tdf) {
UtcT utc = new UtcT();
utc.time = time;
utc.tdf = tdf;
utc.inacclo = (int) (inaccuracy & 0xffffffffL);
utc.inacchi = (short) ((inaccuracy >> 32L) & 0xffffL);
return utc;
}
public static UtcT toUtcT(long time, long inaccuracy) {
return toUtcT(time, inaccuracy, (short) 0);
}
public static UtcT toUtcT(IntervalT inter) {
//
// Note that "time = (upper_ + lower_) / 2" may cause overflow.
//
long inaccuracy = Unsigned.divide(Unsigned.subtract(inter.upper_bound,
inter.lower_bound), 2);
long time = Unsigned.add(inter.lower_bound, inaccuracy);
return toUtcT(time, inaccuracy);
}
public static String toString(UtcT time) {
if (Unsigned.lt(time.time, DCEToPosix))
return "Time less than 1 January 1970 00:00:00";
//
// Get local time
//
long milliTime = Unsigned.add(toJavaMillis(time), time.tdf * 60000);
//
// Convert to string
//
java.text.SimpleDateFormat date = new java.text.SimpleDateFormat(
"MM/dd/yy HH:mm:ss:SSS");
date.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
return date.format(new java.util.Date(milliTime));
}
public static String toTimeString(UtcT time) {
if (Unsigned.lt(time.time, DCEToPosix))
return "Time less than 1 January 1970 00:00:00";
//
// Get local time
//
long milliTime = Unsigned.add(toJavaMillis(time), time.tdf * 60000);
//
// Convert to string
//
java.text.SimpleDateFormat date = new java.text.SimpleDateFormat(
"HH:mm:ss:SSS");
date.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
return date.format(new java.util.Date(milliTime));
}
public static String toString(long time) {
long milliTime = Unsigned.divide(time, 10000L);
long sec = Unsigned.divide(milliTime, 1000);
long msec = Unsigned.mod(milliTime, 1000);
String ret = Long.toString(sec) + ":";
if (msec < 10)
ret = ret + "00";
else if (msec < 100)
ret = ret + "0";
ret = ret + Long.toString(msec);
return ret;
}
public static boolean lessThan(UtcT a, UtcT b) {
return Unsigned.lt(a.time, b.time);
}
public static boolean lessThanEqual(UtcT a, UtcT b) {
return Unsigned.lteq(a.time, b.time);
}
public static boolean greaterThan(UtcT a, UtcT b) {
return Unsigned.gt(a.time, b.time);
}
public static boolean greaterThanEqual(UtcT a, UtcT b) {
return Unsigned.gteq(a.time, b.time);
}
public static boolean equal(UtcT a, UtcT b) {
return a.time == b.time;
}
public static boolean notEqual(UtcT a, UtcT b) {
return a.time != b.time;
}
public static UtcT add(UtcT a, long t) {
UtcT b = new UtcT(a.time, a.inacclo, a.inacchi, a.tdf);
if (Unsigned.lt(Unsigned.subtract(MaxTimeT, b.time), t))
b.time = MaxTimeT;
else
b.time = Unsigned.add(b.time, t);
return b;
}
public static UtcT add(long t, UtcT a) {
return add(a, t);
}
public static UtcT subtract(UtcT a, long t) {
UtcT b = new UtcT(a.time, a.inacclo, a.inacchi, a.tdf);
if (Unsigned.lt(b.time, t))
b.time = 0;
else
b.time = Unsigned.subtract(b.time, t);
return b;
}
}
| 6,382 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/TimeoutPolicyHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/TimeoutPolicy:1.0
//
final public class TimeoutPolicyHolder implements org.omg.CORBA.portable.Streamable
{
public TimeoutPolicy value;
public
TimeoutPolicyHolder()
{
}
public
TimeoutPolicyHolder(TimeoutPolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TimeoutPolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TimeoutPolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TimeoutPolicyHelper.type();
}
}
| 6,383 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LocateRequestPolicy_impl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.LOCATE_REQUEST_POLICY_ID;
import org.apache.yoko.orb.OB.LocateRequestPolicy;
final public class LocateRequestPolicy_impl extends org.omg.CORBA.LocalObject
implements LocateRequestPolicy {
private boolean value_;
// ------------------------------------------------------------------
// Standard IDL to Java Mapping
// ------------------------------------------------------------------
public boolean value() {
return value_;
}
public int policy_type() {
return LOCATE_REQUEST_POLICY_ID.value;
}
public org.omg.CORBA.Policy copy() {
return this;
}
public void destroy() {
}
// ------------------------------------------------------------------
// Yoko internal functions
// Application programs must not use these functions directly
// ------------------------------------------------------------------
public LocateRequestPolicy_impl(boolean value) {
value_ = value;
}
}
| 6,384 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/MessageRoutingUtil.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class MessageRoutingUtil {
public static void getRouterListFromConfig(
org.apache.yoko.orb.OB.ORBInstance orbInstance,
org.omg.MessageRouting.RouterListHolder routerList) {
java.util.Properties properties = orbInstance.getProperties();
java.util.Enumeration keys = properties.keys();
java.util.Vector amiPropKeys = new java.util.Vector();
//
// Get all of the AMI router keys.
//
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
if (!key.startsWith("yoko.ami.router."))
continue;
amiPropKeys.add(key);
}
//
// Sort the keys
//
// NOTE: As with the C++ implementation, this is not the most
// efficient way to sort the list. However, our lists should be
// small enough that this sorting method is OK.
//
String[] routerKeys = (String[]) amiPropKeys.toArray(new String[0]);
for (int i = 0; i < routerKeys.length; ++i) {
int min = i;
for (int j = i + 1; j < routerKeys.length; ++j) {
if (routerKeys[min].compareTo(routerKeys[j]) > 0)
min = j;
}
String tmp = routerKeys[i];
routerKeys[i] = routerKeys[min];
routerKeys[min] = tmp;
}
for (int i = 0; i < routerKeys.length; ++i) {
String value = properties.getProperty(routerKeys[i]);
//
// Strip any quotes that might be around the key value
//
if (value.startsWith("\""))
value = value.substring(1, value.length() - 1);
//
// Create the object depending on how the router address was
// given in the config file. Either we can use the reference
// as specified or use the data to create a corbaloc
//
org.omg.CORBA.ORB orb = orbInstance.getORB();
org.omg.CORBA.Object obj;
try {
if (value.startsWith("corbaloc:")
|| value.startsWith("corbaname:")
|| value.startsWith("IOR:")
|| value.startsWith("relfile:")
|| value.startsWith("file:")) {
obj = orb.string_to_object(value);
} else {
//
// REVISIT: For now, we expect this to be in a
// <host>:<port> format that we can use to create a
// corbaloc address
//
String address = "corbaloc::" + value + "/AMIRouter";
obj = orb.string_to_object(address);
}
} catch (org.omg.CORBA.BAD_PARAM ex) {
continue;
}
//
// NOTE: we don't want to do a _narrow here because the router may
// not be active and we would get an exception. Do an
// _uncheck_narrow so that we can create the object to store in
// the IOR without having to be worried about the router being
// active.
//
org.omg.MessageRouting.Router router = org.omg.MessageRouting.RouterHelper
.unchecked_narrow(obj);
//
// Add the new router to the supplied list of routers
//
int len = routerList.value.length;
org.omg.MessageRouting.Router[] newList = new org.omg.MessageRouting.Router[len + 1];
System.arraycopy(routerList.value, 0, newList, 0, len);
newList[len] = router;
routerList.value = newList;
}
}
public static org.omg.MessageRouting.PersistentRequestRouter getPersistentRouterFromConfig(
org.apache.yoko.orb.OB.ORBInstance orbInstance)
throws org.omg.CORBA.SystemException {
java.util.Properties properties = orbInstance.getProperties();
String key = "yoko.ami.persistent_router";
String value = properties.getProperty(key);
//
// Strip any quotes that might be around the key value
//
if (value.startsWith("\""))
value = value.substring(1, value.length() - 1);
if (key == null)
throw new org.omg.CORBA.BAD_PARAM("No persistent router specified");
//
// Create the object depending on how the router address was
// given in the config file. Either we can use the reference
// as specified or use the data to create a corbaloc
//
org.omg.CORBA.ORB orb = orbInstance.getORB();
org.omg.CORBA.Object obj;
if (value.startsWith("corbaloc:") || value.startsWith("corbaname:")
|| value.startsWith("IOR:") || value.startsWith("relfile:")
|| value.startsWith("file:")) {
obj = orb.string_to_object(value);
} else {
//
// TODO: For now, we expect this to be in a
// <host>:<port> format that we can use to create a
// corbaloc address
//
String address = "corbaloc::" + value + "/AMIPersistentRouter";
obj = orb.string_to_object(address);
}
//
// The persistent request router must be active in order to even
// attempt polling requests so we can safely assume that we can
// perform a narrow. Otherwise, we do want to cause an exception
// to occur.
//
org.omg.MessageRouting.PersistentRequestRouter router;
try {
router = org.omg.MessageRouting.PersistentRequestRouterHelper
.narrow(obj);
} catch (org.omg.CORBA.SystemException ex) {
throw (org.omg.CORBA.TRANSIENT)new org.omg.CORBA.TRANSIENT(
"PersistentRequestRouter not available").initCause(ex);
}
return router;
}
public static void getRouterListFromComponents(
org.apache.yoko.orb.OB.ORBInstance orbInstance,
org.apache.yoko.orb.OCI.ProfileInfo info,
org.omg.MessageRouting.RouterListHolder routerList) {
if (info.major == 1 && info.minor == 0) {
//
// 1.0 profiles do not have tagged components
//
return;
}
for (int i = 0; i < info.components.length; ++i) {
if (info.components[i].tag == org.omg.MessageRouting.TAG_MESSAGE_ROUTERS.value) {
byte[] data = info.components[i].component_data;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
//
// Needed to create Objects
//
in._OB_ORBInstance(orbInstance);
//
// Read the router list from the components
//
org.omg.MessageRouting.Router[] routers = org.omg.MessageRouting.RouterListHelper
.read(in);
//
// Add the new routers to the supplied list of routers
//
int routerLen = routers.length;
int currentLen = routerList.value.length;
org.omg.MessageRouting.Router[] newList = new org.omg.MessageRouting.Router[routerLen
+ currentLen];
System.arraycopy(routerList.value, 0, newList, 0, currentLen);
System.arraycopy(routers, 0, newList, currentLen, routerLen);
routerList.value = newList;
}
}
}
public static org.omg.Messaging.PolicyValue createMessagingPolicyValue(
org.omg.CORBA.Policy policy) {
org.omg.Messaging.PolicyValue value = new org.omg.Messaging.PolicyValue();
//
// Create a PolicyValue based on the type of policy that was passed
// to this method
//
switch (policy.policy_type()) {
case org.omg.Messaging.REBIND_POLICY_TYPE.value: {
org.omg.Messaging.RebindPolicy p = org.omg.Messaging.RebindPolicyHelper
.narrow(policy);
short mode = p.rebind_mode();
value.ptype = org.omg.Messaging.REBIND_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.RebindModeHelper.write(out, mode);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.REQUEST_PRIORITY_POLICY_TYPE.value: {
org.omg.Messaging.RequestPriorityPolicy p = org.omg.Messaging.RequestPriorityPolicyHelper
.narrow(policy);
org.omg.Messaging.PriorityRange range = p.priority_range();
value.ptype = org.omg.Messaging.REQUEST_PRIORITY_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.PriorityRangeHelper.write(out, range);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.REPLY_PRIORITY_POLICY_TYPE.value: {
org.omg.Messaging.ReplyPriorityPolicy p = org.omg.Messaging.ReplyPriorityPolicyHelper
.narrow(policy);
org.omg.Messaging.PriorityRange range = p.priority_range();
value.ptype = org.omg.Messaging.REPLY_PRIORITY_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.PriorityRangeHelper.write(out, range);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.REQUEST_START_TIME_POLICY_TYPE.value: {
org.omg.Messaging.RequestStartTimePolicy p = org.omg.Messaging.RequestStartTimePolicyHelper
.narrow(policy);
org.omg.TimeBase.UtcT time = p.start_time();
value.ptype = org.omg.Messaging.REQUEST_START_TIME_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.TimeBase.UtcTHelper.write(out, time);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.REQUEST_END_TIME_POLICY_TYPE.value: {
org.omg.Messaging.RequestEndTimePolicy p = org.omg.Messaging.RequestEndTimePolicyHelper
.narrow(policy);
org.omg.TimeBase.UtcT time = p.end_time();
value.ptype = org.omg.Messaging.REQUEST_END_TIME_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.TimeBase.UtcTHelper.write(out, time);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.REPLY_START_TIME_POLICY_TYPE.value: {
org.omg.Messaging.ReplyStartTimePolicy p = org.omg.Messaging.ReplyStartTimePolicyHelper
.narrow(policy);
org.omg.TimeBase.UtcT time = p.start_time();
value.ptype = org.omg.Messaging.REPLY_START_TIME_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.TimeBase.UtcTHelper.write(out, time);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.REPLY_END_TIME_POLICY_TYPE.value: {
org.omg.Messaging.RequestEndTimePolicy p = org.omg.Messaging.RequestEndTimePolicyHelper
.narrow(policy);
org.omg.TimeBase.UtcT time = p.end_time();
value.ptype = org.omg.Messaging.REPLY_END_TIME_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.TimeBase.UtcTHelper.write(out, time);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.RELATIVE_REQ_TIMEOUT_POLICY_TYPE.value: {
org.omg.Messaging.RelativeRequestTimeoutPolicy p = org.omg.Messaging.RelativeRequestTimeoutPolicyHelper
.narrow(policy);
long time = p.relative_expiry();
org.omg.TimeBase.UtcT timeout = org.apache.yoko.orb.OB.TimeHelper
.add(org.apache.yoko.orb.OB.TimeHelper.utcNow(0), time);
value.ptype = org.omg.Messaging.REQUEST_END_TIME_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.TimeBase.UtcTHelper.write(out, timeout);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.RELATIVE_RT_TIMEOUT_POLICY_TYPE.value: {
org.omg.Messaging.RelativeRoundtripTimeoutPolicy p = org.omg.Messaging.RelativeRoundtripTimeoutPolicyHelper
.narrow(policy);
long time = p.relative_expiry();
org.omg.TimeBase.UtcT timeout = org.apache.yoko.orb.OB.TimeHelper
.add(org.apache.yoko.orb.OB.TimeHelper.utcNow(0), time);
value.ptype = org.omg.Messaging.REPLY_END_TIME_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.TimeBase.UtcTHelper.write(out, timeout);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.ROUTING_POLICY_TYPE.value: {
org.omg.Messaging.RoutingPolicy p = org.omg.Messaging.RoutingPolicyHelper
.narrow(policy);
org.omg.Messaging.RoutingTypeRange range = p.routing_range();
value.ptype = org.omg.Messaging.ROUTING_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.RoutingTypeRangeHelper.write(out, range);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.MAX_HOPS_POLICY_TYPE.value: {
org.omg.Messaging.MaxHopsPolicy p = org.omg.Messaging.MaxHopsPolicyHelper
.narrow(policy);
short hops = p.max_hops();
value.ptype = org.omg.Messaging.MAX_HOPS_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
out.write_ushort(hops);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
case org.omg.Messaging.QUEUE_ORDER_POLICY_TYPE.value: {
org.omg.Messaging.QueueOrderPolicy p = org.omg.Messaging.QueueOrderPolicyHelper
.narrow(policy);
short order = p.allowed_orders();
value.ptype = org.omg.Messaging.QUEUE_ORDER_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.OrderingHelper.write(out, order);
value.pvalue = new byte[buf.length()];
System.arraycopy(buf.data(), 0, value.pvalue, 0, buf.length());
break;
}
default: {
throw new org.omg.CORBA.INV_POLICY();
}
} // End of switch
return value;
}
public static void getComponentPolicyValues(
org.omg.PortableInterceptor.IORInfo info,
org.omg.Messaging.PolicyValueSeqHolder policies) {
//
// Retrieve the value for the REQUEST_PRIORITY_POLICY_TYPE
//
try {
org.omg.CORBA.Policy p = info
.get_effective_policy(org.omg.Messaging.REQUEST_PRIORITY_POLICY_TYPE.value);
org.omg.Messaging.PolicyValue value = createMessagingPolicyValue(p);
//
// Add the new policy to the supplied list of policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
newSeq[len] = value;
policies.value = newSeq;
} catch (org.omg.CORBA.INV_POLICY ex) {
}
//
// Retrieve the value for the REPLY_PRIORITY_POLICY_TYPE
//
try {
org.omg.CORBA.Policy p = info
.get_effective_policy(org.omg.Messaging.REPLY_PRIORITY_POLICY_TYPE.value);
org.omg.Messaging.PolicyValue value = createMessagingPolicyValue(p);
//
// Add the new policy to the supplied list of policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
newSeq[len] = value;
policies.value = newSeq;
} catch (org.omg.CORBA.INV_POLICY ex) {
}
//
// Retrieve the value for the MAX_HOPS_POLICY_TYPE
//
try {
org.omg.CORBA.Policy p = info
.get_effective_policy(org.omg.Messaging.MAX_HOPS_POLICY_TYPE.value);
org.omg.Messaging.PolicyValue value = createMessagingPolicyValue(p);
//
// Add the new policy to the supplied list of policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
newSeq[len] = value;
policies.value = newSeq;
} catch (org.omg.CORBA.INV_POLICY ex) {
}
//
// Retrieve the value for the QUEUE_ORDER_POLICY_TYPE
//
try {
org.omg.CORBA.Policy p = info
.get_effective_policy(org.omg.Messaging.QUEUE_ORDER_POLICY_TYPE.value);
org.omg.Messaging.PolicyValue value = createMessagingPolicyValue(p);
//
// Add the new policy to the supplied list of policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
newSeq[len] = value;
policies.value = newSeq;
} catch (org.omg.CORBA.INV_POLICY ex) {
}
}
public static void getInvocationPolicyValues(
org.apache.yoko.orb.OB.RefCountPolicyList policyList,
org.omg.Messaging.PolicyValueSeqHolder policies) {
//
// TODO: We should revisit this. The spec is not very clear on
// whether we should propogate policies that have no default values
// and that have not been overriden by the client. For now, we
// assume that only default or overriden policyes will be
// propogated in the INVOCATION_POLICIES service context.
//
//
// A set of flags that will indicate how to handle specific
// policies
//
boolean rebind = false;
boolean queueOrder = false;
boolean useRelativeRequest = false;
boolean useRelativeRoundtrip = false;
//
// There is a special case we need to watch out for. The two
// relative timeouts are actually a different way to specify the
// request and reply end times. We don't want them to overwrite
// each other so we wil pick the earliest values if both times
// are supplied (e.g. RelativeRequest and RequestEnd or
// RelativeRoundtrip and ReplyEnd)
//
if (policyList.relativeRequestTimeout != 0) {
useRelativeRequest = true;
if (org.apache.yoko.orb.OB.TimeHelper.notEqual(
policyList.requestEndTime,
org.apache.yoko.orb.OB.TimeHelper.utcMin())) {
//
// Compare the times and pick the earliest
//
org.omg.TimeBase.UtcT timeout = org.apache.yoko.orb.OB.TimeHelper
.utcMin();
if (org.apache.yoko.orb.OB.TimeHelper.greaterThan(timeout,
policyList.requestEndTime))
useRelativeRequest = false;
}
}
if (policyList.relativeRoundTripTimeout != 0) {
useRelativeRoundtrip = true;
if (org.apache.yoko.orb.OB.TimeHelper.notEqual(
policyList.replyEndTime, org.apache.yoko.orb.OB.TimeHelper
.utcMin())) {
//
// Compare the times and pick the earliest
//
org.omg.TimeBase.UtcT timeout = org.apache.yoko.orb.OB.TimeHelper
.utcMin();
if (org.apache.yoko.orb.OB.TimeHelper.greaterThan(timeout,
policyList.replyEndTime))
useRelativeRequest = false;
}
}
//
// Go through all of the policies in the policy list and create the
// appropriate PolicyValue
//
int numPolicies = policyList.value.length;
for (int i = 0; i < numPolicies; ++i) {
try {
int type = policyList.value[i].policy_type();
if ((type == org.omg.Messaging.RELATIVE_REQ_TIMEOUT_POLICY_TYPE.value && useRelativeRequest == false)
|| (type == org.omg.Messaging.REQUEST_END_TIME_POLICY_TYPE.value && useRelativeRequest == true)) {
//
// This is to handle cases when both policies are set
//
continue;
}
if ((type == org.omg.Messaging.RELATIVE_RT_TIMEOUT_POLICY_TYPE.value && useRelativeRoundtrip == false)
|| (type == org.omg.Messaging.REPLY_END_TIME_POLICY_TYPE.value && useRelativeRoundtrip == true)) {
//
// This is to handle cases when both policies are set
//
continue;
}
org.omg.Messaging.PolicyValue val = createMessagingPolicyValue(policyList.value[i]);
//
// We also need to watch out for rebind and queue order.
// If they have been specified by the client, we don't need
// to use their defaults. Flag this so we know about it
// later
//
if (val.ptype == org.omg.Messaging.REBIND_POLICY_TYPE.value)
rebind = true;
if (val.ptype == org.omg.Messaging.QUEUE_ORDER_POLICY_TYPE.value)
queueOrder = true;
//
// Add the policy to the supplied list of policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
policies.value = newSeq;
} catch (org.omg.CORBA.INV_POLICY ex) {
}
}
if (rebind == false) {
//
// We need to use the default value for the rebind policy
//
org.omg.Messaging.PolicyValue val = new org.omg.Messaging.PolicyValue();
val.ptype = org.omg.Messaging.REBIND_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.RebindModeHelper
.write(out, policyList.rebindMode);
val.pvalue = new byte[out._OB_pos()];
System.arraycopy(buf.data(), 0, val.pvalue, 0, buf.length());
//
// Add the rebind policy to the list of supplied policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
newSeq[len] = val;
policies.value = newSeq;
}
if (queueOrder == false) {
//
// We need to use the default value for the queue order policy
//
org.omg.Messaging.PolicyValue val = new org.omg.Messaging.PolicyValue();
val.ptype = org.omg.Messaging.QUEUE_ORDER_POLICY_TYPE.value;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
out._OB_writeEndian();
org.omg.Messaging.OrderingHelper.write(out, policyList.queueOrder);
val.pvalue = new byte[out._OB_pos()];
System.arraycopy(buf.data(), 0, val.pvalue, 0, buf.length());
//
// Add the queue order policy to the list of supplied policies
//
int len = policies.value.length;
org.omg.Messaging.PolicyValue[] newSeq = new org.omg.Messaging.PolicyValue[len + 1];
System.arraycopy(policies.value, 0, newSeq, 0, len);
newSeq[len] = val;
policies.value = newSeq;
}
}
public static org.omg.CORBA.Policy[] getPolicyListFromPolicyValues(
org.omg.Messaging.PolicyValue[] policies) {
java.util.Vector list = new java.util.Vector(0);
//
// Loop through the PolicyValueSeq and create necessary policies
//
int policiesLength = policies.length;
for (int i = 0; i < policiesLength; ++i) {
org.omg.CORBA.Policy policy;
try {
policy = getPolicyFromPolicyValue(policies[i]);
} catch (org.omg.CORBA.INV_POLICY ex) {
continue;
}
//
// Add the new policy to the list
//
list.addElement(policy);
}
org.omg.CORBA.Policy[] policyList = new org.omg.CORBA.Policy[list
.size()];
for (int i = 0; i < list.size(); ++i)
policyList[i] = (org.omg.CORBA.Policy) list.elementAt(i);
return policyList;
}
public static org.omg.CORBA.Policy getPolicyFromPolicyValue(
org.omg.Messaging.PolicyValue policyValue) {
//
// Create the appropriate policy depending on the policy value we
// were given
//
switch (policyValue.ptype) {
case org.omg.Messaging.REBIND_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
short mode = org.omg.Messaging.RebindModeHelper.read(in);
return new org.apache.yoko.orb.Messaging.RebindPolicy_impl(mode);
}
case org.omg.Messaging.REQUEST_PRIORITY_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.Messaging.PriorityRange range = org.omg.Messaging.PriorityRangeHelper
.read(in);
return new org.apache.yoko.orb.Messaging.RequestPriorityPolicy_impl(
range);
}
case org.omg.Messaging.REPLY_PRIORITY_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.Messaging.PriorityRange range = org.omg.Messaging.PriorityRangeHelper
.read(in);
return new org.apache.yoko.orb.Messaging.ReplyPriorityPolicy_impl(
range);
}
case org.omg.Messaging.REQUEST_START_TIME_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.TimeBase.UtcT time = org.omg.TimeBase.UtcTHelper.read(in);
return new org.apache.yoko.orb.Messaging.RequestStartTimePolicy_impl(
time);
}
case org.omg.Messaging.REQUEST_END_TIME_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.TimeBase.UtcT time = org.omg.TimeBase.UtcTHelper.read(in);
return new org.apache.yoko.orb.Messaging.RequestEndTimePolicy_impl(
time);
}
case org.omg.Messaging.REPLY_START_TIME_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.TimeBase.UtcT time = org.omg.TimeBase.UtcTHelper.read(in);
return new org.apache.yoko.orb.Messaging.ReplyStartTimePolicy_impl(
time);
}
case org.omg.Messaging.REPLY_END_TIME_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.TimeBase.UtcT time = org.omg.TimeBase.UtcTHelper.read(in);
return new org.apache.yoko.orb.Messaging.ReplyEndTimePolicy_impl(
time);
}
case org.omg.Messaging.ROUTING_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
org.omg.Messaging.RoutingTypeRange range = org.omg.Messaging.RoutingTypeRangeHelper
.read(in);
return new org.apache.yoko.orb.Messaging.RoutingPolicy_impl(range);
}
case org.omg.Messaging.MAX_HOPS_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
short hops = in.read_ushort();
return new org.apache.yoko.orb.Messaging.MaxHopsPolicy_impl(hops);
}
case org.omg.Messaging.QUEUE_ORDER_POLICY_TYPE.value: {
byte[] data = policyValue.pvalue;
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
data, data.length);
org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
buf);
in._OB_readEndian();
short order = org.omg.Messaging.OrderingHelper.read(in);
return new org.apache.yoko.orb.Messaging.QueueOrderPolicy_impl(
order);
}
default: {
throw new org.omg.CORBA.INV_POLICY();
}
} // End of switch
// return org.omg.CORBA.Policy._nil();
}
}
| 6,385 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ORBControl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import static org.apache.yoko.orb.OB.MinorCodes.MinorDestroyWouldBlock;
import static org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed;
import static org.apache.yoko.orb.OB.MinorCodes.MinorShutdownCalled;
import static org.apache.yoko.orb.OB.MinorCodes.describeBadInvOrder;
import static org.apache.yoko.orb.OB.MinorCodes.describeInitialize;
import static org.omg.CORBA.CompletionStatus.COMPLETED_NO;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Phaser;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.ReadWriteLock;
import org.apache.yoko.orb.OBPortableServer.POAManagerFactory_impl;
import org.apache.yoko.orb.OBPortableServer.POA_impl;
import org.apache.yoko.orb.PortableServer.Current_impl;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.INITIALIZE;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.CurrentPackage.NoContext;
public final class ORBControl {
//
// The ORB instance
//
ORBInstance orbInstance_;
//
// The ORBControl state
//
private enum State { NOT_RUNNING, RUNNING, SERVER_SHUTDOWN, CLIENT_SHUTDOWN, DESTROYED };
private volatile State state; // State of the ORB
//
// Has shutdown been called?
//
private final CountDownLatch shutdown = new CountDownLatch(1);
//
// The Root POA
//
private POA rootPOA_; // The Root POA
//
// The thread id of the main thread (that is the first thread that
// calls run, perform_work or work_pending)
//
private volatile Thread mainThread_;
private long shutdownTimeout_ = 2;//seconds
// ----------------------------------------------------------------------
// ORBControl private and protected member implementations
// ----------------------------------------------------------------------
//
// Complete shutdown of the ORB, if necessary
//
private synchronized void completeServerShutdown() {
//
// If the shutdown_ is false, or the server side has already
// shutdown then do nothing
//
if (shutdown.getCount() != 0 || state == State.SERVER_SHUTDOWN)
return;
Assert._OB_assert(state != State.CLIENT_SHUTDOWN && state != State.DESTROYED);
//
// If run was called then only the main thread may complete the
// shutdown
//
Assert._OB_assert(state == State.NOT_RUNNING || mainThread_ == Thread.currentThread());
//
// Get the POAManagerFactory implementation
//
POAManagerFactory_impl factory = (POAManagerFactory_impl) orbInstance_.getPOAManagerFactory();
//
// Deactivate all of the POAManagers
//
factory._OB_deactivate();
//
// Wait for all the threads in the server worker group to
// terminate
//
waitForServerThreads();
notifyAll();
}
private void waitForServerThreads() {
shutdownExecutor(orbInstance_.getServerPhaser(), orbInstance_.getServerExecutor());
//
// Get the DispatchStrategyFactory implementation and
// destroy it. It must be destroyed here so that the
// thread pools get destroyed before OCI::Current_impl
// gets destroyed by the destruction of the Root
// POA. Otherwise, thread specific data for the thread
// pool threads will not get released.
//
DispatchStrategyFactory dsFactory = orbInstance_.getDispatchStrategyFactory();
DispatchStrategyFactory_impl dsFactoryImpl = (DispatchStrategyFactory_impl) dsFactory;
dsFactoryImpl._OB_destroy();
//
// Mark the server side state as shutdown and notify any
// waiting threads
//
state = State.SERVER_SHUTDOWN;
//
// Destroy the root POA
//
if (rootPOA_ != null) {
rootPOA_.destroy(true, true);
rootPOA_ = null;
}
}
//
// Validate the state
//
private synchronized void validateState() {
//
// The ORB destroys this object, so it's an initialization
// error if the this operation is called after ORB destruction
//
if (state == State.DESTROYED)
throw new org.omg.CORBA.INITIALIZE(
org.apache.yoko.orb.OB.MinorCodes.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
if (state == State.SERVER_SHUTDOWN || state == State.CLIENT_SHUTDOWN)
throw new org.omg.CORBA.BAD_INV_ORDER(
org.apache.yoko.orb.OB.MinorCodes.describeBadInvOrder(org.apache.yoko.orb.OB.MinorCodes.MinorShutdownCalled),
org.apache.yoko.orb.OB.MinorCodes.MinorShutdownCalled, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
if (state == State.NOT_RUNNING) {
//
// Remember the main thread id
//
mainThread_ = Thread.currentThread();
//
// Set the state to State.RUNNING
//
state = State.RUNNING;
}
}
private synchronized void blockServerShutdownComplete() {
//
// Wait for the server side to shutdown. Note that the client
// side shutting down or the state being destroyed also
// implies that the server side has shutdown
//
while (state == State.RUNNING) {
try {
wait();
} catch (InterruptedException ex) {
}
}
}
// ----------------------------------------------------------------------
// ORBControl public member implementations
// ----------------------------------------------------------------------
public ORBControl() {
state = State.NOT_RUNNING;
}
//
// Destroy the ORBControl
//
public synchronized void destroy() {
//
// destroy() may not be called unless the client side has been
// shutdown
//
Assert._OB_assert(state == State.CLIENT_SHUTDOWN);
state = State.DESTROYED;
//
// Set the ORBInstance object to nil
//
orbInstance_ = null;
}
//
// Set the ORBInstance object
//
public void setORBInstance(ORBInstance instance) {
orbInstance_ = instance;
}
//
// Determine if there if the ORB needs the main thread to perform
// some work
//
public boolean workPending() {
validateState();
//
// If this is not the main thread then do nothing
//
if (mainThread_ != Thread.currentThread())
return false;
//
// Validate state will throw an exception if state is
// ServerShutdown, ClientShutdown or Destroyed. Therefore if
// shutdown_ is true, then a server side shutdown is pending.
//
return (shutdown.getCount() == 0);
}
//
// Perform one unit of work
//
public void performWork() {
validateState();
//
// If this is not the main thread then do nothing
//
if (mainThread_ != Thread.currentThread())
return;
completeServerShutdown();
}
//
// Run the ORB event loop
//
public void run() {
validateState();
//
// If this is not the main thread then block until the ORB is
// shutdown
//
if (mainThread_ != Thread.currentThread()) {
blockServerShutdownComplete();
return;
}
//
// Validate state will throw an exception if state is
// ServerShutdown, ClientShutdown or Destroyed. Therefore if
// shutdown_ is true, then a server side shutdown is pending
// so complete it now.
//
if (shutdown.getCount() == 0) {
completeServerShutdown();
return;
}
//
// Block until the ORB server side has shutdown. Note that the
// client side shutting down or the state being destroyed also
// implies that the server side has shutdown
//
do {
try {
shutdown.await();
} catch (InterruptedException ignored) {
}
//
// After this call state is either ShutdownClient, or
// Running
//
completeServerShutdown();
} while (state == State.RUNNING);
}
//
// Shutdown the server side of the ORB
//
// ASYNC SAFE if waitForCompletion == false
//
public void shutdownServer(boolean waitForCompletion) {
//
// The ORB destroys this object, so it's an initialization error
// if the this operation is called after ORB destruction
//
if (state == State.DESTROYED)
throw new INITIALIZE(describeInitialize(MinorORBDestroyed), MinorORBDestroyed, COMPLETED_NO);
if (state == State.SERVER_SHUTDOWN || state == State.CLIENT_SHUTDOWN)
throw new BAD_INV_ORDER(describeBadInvOrder(MinorShutdownCalled), MinorShutdownCalled, COMPLETED_NO);
//
// If waitForCompletion is true then find out whether we're inside
// a method invocation -- if so throw a BAD_INV_ORDER exception
//
if (waitForCompletion) {
boolean inInvocation = false;
try {
InitialServiceManager initialServiceManager = orbInstance_.getInitialServiceManager();
org.omg.CORBA.Object o = initialServiceManager.resolveInitialReferences("POACurrent");
Current_impl current = (Current_impl) o;
inInvocation = current._OB_inUpcall();
if (inInvocation) {
//
// Check whether or not the request is dispatched in this
// POAManager's ORB or another ORB.
//
try {
POA_impl p = (POA_impl) current.get_POA();
inInvocation = (p._OB_ORBInstance() == orbInstance_);
} catch (NoContext ex) {
}
}
} catch (ClassCastException ex) {
} catch (InvalidName ex) {
}
if (inInvocation)
throw new BAD_INV_ORDER(describeBadInvOrder(MinorDestroyWouldBlock), MinorDestroyWouldBlock, COMPLETED_NO);
}
//
// Unblock run(). This should be done immediately before
// the return since this can cause the main loop to wake and
// complete the shutdown (thus, for instance, destroying the
// POAManagerFactory).
//
shutdown.countDown();
//
// waitForCompletion false? We're done.
//
if (!waitForCompletion)
return;
//
// If run was called and this is not the main thread and
// waitForCompletion is true then wait for the shutdown to
// complete.
//
if (state == State.RUNNING && mainThread_ != Thread.currentThread()) {
blockServerShutdownComplete();
return;
}
//
// This is the main thread -- complete the shutdown process
//
completeServerShutdown();
}
//
// Shutdown the server (if necessary) & client side of the ORB
//
public synchronized void shutdownServerClient() {
//
// The ORB destroys this object, so it's an initialization
// error if the this operation is called after ORB destruction
//
if (state == State.DESTROYED)
throw new org.omg.CORBA.INITIALIZE(
org.apache.yoko.orb.OB.MinorCodes.describeInitialize(org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed),
org.apache.yoko.orb.OB.MinorCodes.MinorORBDestroyed, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
//
// If the ORB client side is already shutdown, then we're done
//
if (state == State.CLIENT_SHUTDOWN)
return;
if (orbInstance_ != null) {
//
// First shutdown the server side, if necessary
//
if (state != State.SERVER_SHUTDOWN)
shutdownServer(true);
//
// The server shutdown must have completed
//
Assert._OB_assert(state == State.SERVER_SHUTDOWN);
//
// Shutdown the client side. Continue to dispatch events until all
// client type event handlers have unregistered.
//
ClientManager clientManager = orbInstance_.getClientManager();
clientManager.destroy();
//
// Wait for all the threads in the client worker group to
// terminate
//
shutdownExecutor(orbInstance_.getClientPhaser(), orbInstance_.getClientExecutor());
}
//
// Mark the ORB's client side as shutdown and notify any
// waiters
//
state = State.CLIENT_SHUTDOWN;
notifyAll();
}
private void shutdownExecutor(Phaser phaser, ExecutorService executor) {
int phase = phaser.arrive();//release the system's "lock"
//phaser advances after all GIOPConnectionThreaded have shut down (gracefully or abort)
try {
phaser.awaitAdvanceInterruptibly(phase, shutdownTimeout_, TimeUnit.SECONDS);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
} catch (TimeoutException e) {
} finally {
phaser.forceTermination();
}
executor.shutdownNow();
}
//
// Initialize the Root POA
//
public void initializeRootPOA(org.omg.CORBA.ORB orb) {
String serverId = orbInstance_.getServerId();
//
// If there is no server id then set to "_RootPOA"
//
if (serverId.length() == 0)
serverId = "_RootPOA";
//
// Get the initial service manager
//
InitialServiceManager ism = orbInstance_.getInitialServiceManager();
//
// Create the Root POAManager
//
org.apache.yoko.orb.OBPortableServer.POAManagerFactory factory = null;
try {
factory = org.apache.yoko.orb.OBPortableServer.POAManagerFactoryHelper.narrow(ism.resolveInitialReferences("POAManagerFactory"));
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
Assert._OB_assert(ex);
}
//
// First attempt to locate the root POAManager
//
org.apache.yoko.orb.OBPortableServer.POAManager manager = null;
org.omg.PortableServer.POAManager[] managers = factory.list();
for (int i = 0; i < managers.length; i++) {
if (managers[i].get_id().equals("RootPOAManager")) {
manager = (org.apache.yoko.orb.OBPortableServer.POAManager) managers[i];
break;
}
}
//
// If the root POAManager doesn't exist then create it
//
if (manager == null) {
try {
org.omg.CORBA.Policy[] emptyPl = new org.omg.CORBA.Policy[0];
manager = (org.apache.yoko.orb.OBPortableServer.POAManager) (factory.create_POAManager("RootPOAManager", emptyPl));
} catch (org.omg.PortableServer.POAManagerFactoryPackage.ManagerAlreadyExists ex) {
Assert._OB_assert(ex);
}
// catch(org.apache.yoko.orb.OCI.InvalidParam ex)
// {
// Logger logger = orbInstance_.getLogger();
// String err = "invalid configuration parameter " +
// "for RootPOAManager: " + ex.reason;
// logger.error(err);
// throw new org.omg.CORBA.INITIALIZE(err);
// }
catch (org.omg.CORBA.PolicyError ex) {
// TODO : Is this correct?
Assert._OB_assert(ex);
}
}
//
// Create the Root POA
//
org.apache.yoko.orb.OBPortableServer.POA_impl root = new org.apache.yoko.orb.OBPortableServer.POA_impl(orb, orbInstance_, serverId, manager);
root._OB_addPolicyFactory();
rootPOA_ = root;
try {
ism.addInitialReference("RootPOA", root, true);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
Assert._OB_assert(ex);
}
//
// Ask the POAManagerFactory to initialize this servers connection
// to the IMR
//
// TODO-B3: Is there some other point that can be used to do this?
//
org.apache.yoko.orb.OBPortableServer.POAManagerFactory_impl factoryImpl = (org.apache.yoko.orb.OBPortableServer.POAManagerFactory_impl) factory;
factoryImpl._OB_initializeIMR(root, this);
}
}
| 6,386 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ObjectIdHasher.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// All connected implementations
//
public class ObjectIdHasher {
private byte[] oid_;
private int hashCode_;
public ObjectIdHasher(byte[] oid) {
oid_ = oid;
hashCode_ = 0;
int offset = 0;
int len = oid.length;
if (len < 16) {
for (int i = len; i > 0; i--)
hashCode_ = (hashCode_ * 37) + (int) oid[offset++];
} else {
int skip = len / 8;
for (int i = len; i > 0; i -= skip, offset += skip)
hashCode_ = (hashCode_ * 39) + (int) oid[offset];
}
}
public byte[] getObjectId() {
return oid_;
}
public int hashCode() {
return hashCode_;
}
public boolean equals(java.lang.Object o) {
ObjectIdHasher h = (ObjectIdHasher) o;
return comp(oid_, h.oid_);
}
public static boolean comp(byte[] id1, byte[] id2) {
if (id1.length != id2.length)
return false;
for (int i = 0; i < id1.length; i++)
if (id1[i] != id2[i])
return false;
return true;
}
}
| 6,387 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeSetInfo.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class CodeSetInfo {
public String description;
int rgy_value;
int char_values_size;
short[] char_values;
public short max_bytes;
CodeSetInfo(String d, int r, int c, short[] v, short m) {
description = d;
rgy_value = r;
char_values_size = c;
char_values = v;
max_bytes = m;
}
}
| 6,388 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CharMapInfo.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class CharMapInfo {
String name;
public int upper_bound;
public short[] map_values;
CharMapInfo(String n, int u, short[] m) {
name = n;
upper_bound = u;
map_values = m;
}
}
| 6,389 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CoreTraceLevels.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.OB.Logger;
final public class CoreTraceLevels {
private int traceConnections_;
private int traceRetry_;
private int traceRequestsIn_;
private int traceRequestsOut_;
public CoreTraceLevels(Logger logger, java.util.Properties properties) {
traceConnections_ = 0;
traceRetry_ = 0;
traceRequestsIn_ = 0;
traceRequestsOut_ = 0;
String propRoot = "yoko.orb.trace.";
java.util.Enumeration keys = properties.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
if (!key.startsWith(propRoot))
continue;
String value = properties.getProperty(key);
Assert._OB_assert(value != null);
if (key.equals("yoko.orb.trace.connections")) {
try {
traceConnections_ = Integer.parseInt(value);
} catch (NumberFormatException ex) {
logger.warning("ORB.init: invalid value for " + key);
}
} else if (key.equals("yoko.orb.trace.retry")) {
try {
traceRetry_ = Integer.parseInt(value);
} catch (NumberFormatException ex) {
logger.warning("ORB.init: invalid value for " + key);
}
} else if (key.equals("yoko.orb.trace.requests")) {
try {
traceRequestsIn_ = Integer.parseInt(value);
traceRequestsOut_ = Integer.parseInt(value);
} catch (NumberFormatException ex) {
logger.warning("ORB.init: invalid value for " + key);
}
} else if (key.equals("yoko.orb.trace.requests_in")) {
try {
traceRequestsIn_ = Integer.parseInt(value);
} catch (NumberFormatException ex) {
logger.warning("ORB.init: invalid value for " + key);
}
} else if (key.equals("yoko.orb.trace.requests_out")) {
try {
traceRequestsOut_ = Integer.parseInt(value);
} catch (NumberFormatException ex) {
logger.warning("ORB.init: invalid value for " + key);
}
} else {
logger.warning("ORB.init: unknown property: " + key);
}
}
}
public int traceConnections() {
return traceConnections_;
}
public int traceRetry() {
return traceRetry_;
}
public int traceRequestsIn() {
return traceRequestsIn_;
}
public int traceRequestsOut() {
return traceRequestsOut_;
}
}
| 6,390 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/InterceptorPolicyOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/InterceptorPolicy:1.0
//
/**
*
* The interceptor policy. This policy can be used to control whether
* the client-side interceptors are called.
*
**/
public interface InterceptorPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:orb.yoko.apache.org/OB/InterceptorPolicy/value:1.0
//
/**
*
* If an object reference has an <code>InterceptorPolicy</code>
* set and <code>value</code> is <code>FALSE</code> then any
* installed client-side interceptors are not called. Otherwise,
* interceptors are called for each method invocation. The default
* value is <code>TRUE</code>.
*
**/
boolean
value();
}
| 6,391 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeConverterNone.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final class CodeConverterNone extends CodeConverterBase {
// ------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------
CodeConverterNone(CodeSetInfo fromSet, CodeSetInfo toSet) {
super(fromSet, toSet);
}
// ------------------------------------------------------------------
// Public member implementations
// ------------------------------------------------------------------
public boolean conversionRequired() {
return true;
}
public char read_wchar(org.apache.yoko.orb.CORBA.InputStream in, int len) {
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorNoWcharCodeSet),
org.apache.yoko.orb.OB.MinorCodes.MinorNoWcharCodeSet,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public void write_wchar(org.apache.yoko.orb.CORBA.OutputStream out, char v) {
throw new org.omg.CORBA.INV_OBJREF(org.apache.yoko.orb.OB.MinorCodes
.describeInvObjref(org.apache.yoko.orb.OB.MinorCodes.MinorWcharCodeSetRequired),
org.apache.yoko.orb.OB.MinorCodes.MinorWcharCodeSetRequired,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public int read_count_wchar(char value) {
throw new org.omg.CORBA.BAD_PARAM(org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorNoWcharCodeSet),
org.apache.yoko.orb.OB.MinorCodes.MinorNoWcharCodeSet,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public int write_count_wchar(char v) {
throw new org.omg.CORBA.INV_OBJREF(org.apache.yoko.orb.OB.MinorCodes
.describeInvObjref(org.apache.yoko.orb.OB.MinorCodes.MinorWcharCodeSetRequired),
org.apache.yoko.orb.OB.MinorCodes.MinorWcharCodeSetRequired,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
public char convert(char v) {
throw new org.omg.CORBA.INV_OBJREF(org.apache.yoko.orb.OB.MinorCodes
.describeInvObjref(org.apache.yoko.orb.OB.MinorCodes.MinorWcharCodeSetRequired),
org.apache.yoko.orb.OB.MinorCodes.MinorWcharCodeSetRequired,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
| 6,392 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPConnection.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
import org.apache.yoko.orb.CORBA.InputStream;
import org.apache.yoko.orb.OBPortableServer.POAManager_impl;
import org.apache.yoko.orb.OCI.ConnectorInfo;
import org.apache.yoko.orb.OCI.GiopVersion;
import org.apache.yoko.orb.OCI.Transport;
import org.omg.CONV_FRAME.CodeSetContext;
import org.omg.CONV_FRAME.CodeSetContextHolder;
import org.omg.CORBA.COMM_FAILURE;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.SystemExceptionHelper;
import org.omg.CORBA.TRANSIENT;
import org.omg.CORBA.UNKNOWN;
import org.omg.GIOP.LocateStatusType_1_2;
import org.omg.GIOP.ReplyStatusType_1_2;
import org.omg.IOP.CodeSets;
import org.omg.IOP.IOR;
import org.omg.IOP.IORHelper;
import org.omg.IOP.IORHolder;
import org.omg.IOP.ServiceContext;
import org.omg.IOP.UnknownExceptionInfo;
import org.omg.PortableServer.POAManager;
import org.omg.SendingContext.CodeBase;
import java.util.concurrent.atomic.AtomicInteger;
abstract public class GIOPConnection implements DowncallEmitter, UpcallReturn {
static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(GIOPConnection.class.getName());
// ----------------------------------------------------------------
// Inner classes
// ----------------------------------------------------------------
/* access operations class */
public static final class AccessOp {
public static final int Nil = 0;
public static final int Read = 1;
public static final int Write = 2;
public static final int Close = 4;
public static final int All = 7;
}
/* connection properties */
public static final class Property {
public static final int RequestSent = 1;
public static final int ReplySent = 2;
public static final int Destroyed = 4;
public static final int CreatedByClient = 8;
public static final int ClientEnabled = 16;
public static final int ServerEnabled = 32;
public static final int ClosingLogged = 64;
}
/* connection states */
public static final class State {
public static final int Active = 1;
public static final int Holding = 2;
public static final int Closing = 3;
public static final int Error = 4;
public static final int Closed = 5;
}
/* task to execute when ACM timer signal arrives */
final class ACMTask extends java.util.TimerTask {
GIOPConnection connection_;
public ACMTask(GIOPConnection parent) {
connection_ = parent;
}
public void run() {
//
// execute the callback method
//
connection_.ACM_callback();
//
// break cyclic dependency
//
connection_ = null;
}
}
// ----------------------------------------------------------------
// Member data
// ----------------------------------------------------------------
/** the next request id */
private final AtomicInteger nextRequestId;
/** the ORB instance this connection is bound with */
protected ORBInstance orbInstance_ = null;
/** transport this connection represents */
protected Transport transport_ = null;
/** Client parent (null if server-side only) */
private final ConnectorInfo outboundConnectionKey;
/** Object-adapter interface (null if client-side only) */
protected OAInterface oaInterface_ = null;
/** storage space for unsent/pending messages */
protected MessageQueue messageQueue_ = new MessageQueue();
/** enabled processing operations */
protected int enabledOps_ = AccessOp.Nil;
/** enabled connection property flags */
protected int properties_ = 0;
/** state of this connection */
protected int state_ = State.Holding;
/** number of upcalls in progress */
protected int upcallsInProgress_ = 0;
/** code converters used by the connection */
protected CodeConverters codeConverters_ = null;
/** maximum GIOP version encountered during message transactions */
protected org.omg.GIOP.Version giopVersion_ = new org.omg.GIOP.Version(
(byte) 0, (byte) 0);
/** ACM timeout variables */
protected int shutdownTimeout_ = 2;
protected int idleTimeout_ = 0;
/** timer used for ACM management */
protected java.util.Timer acmTimer_ = null;
private CodeBase serverRuntime_;
protected ACMTask acmTask_ = null;
// ----------------------------------------------------------------
// Protected methods
// ----------------------------------------------------------------
//
// check if its compliant for this connection to send a
// CloseConnection message to its peer
//
synchronized protected boolean canSendCloseConnection() {
//
// any GIOP versioned server can send a CloseConnection
//
if ((properties_ & Property.ServerEnabled) != 0)
return true;
//
// anything >= than GIOP 1.2 can send a CloseConnection
//
if (giopVersion_.major > 1
|| (giopVersion_.major == 1 && giopVersion_.minor >= 2))
return true;
//
// otherwise we can't send it
//
return false;
}
/** read the codeset information from the SCL */
protected void readCodeConverters(org.omg.IOP.ServiceContext[] scl) {
if (codeConverters_ != null)
return;
for (ServiceContext aScl : scl) {
if (aScl.context_id == CodeSets.value) {
CodeSetContextHolder codeSetContextH = new CodeSetContextHolder();
CodeSetUtil.extractCodeSetContext(aScl, codeSetContextH);
CodeSetContext codeSetContext = codeSetContextH.value;
CodeSetDatabase db = CodeSetDatabase.instance();
codeConverters_ = new CodeConverters();
codeConverters_.inputCharConverter = db.getConverter(
orbInstance_.getNativeCs(), codeSetContext.char_data);
codeConverters_.outputCharConverter = db.getConverter(
codeSetContext.char_data, orbInstance_.getNativeCs());
codeConverters_.inputWcharConverter = db.getConverter(
orbInstance_.getNativeWcs(), codeSetContext.wchar_data);
codeConverters_.outputWcharConverter = db.getConverter(
codeSetContext.wchar_data, orbInstance_.getNativeWcs());
CoreTraceLevels coreTraceLevels = orbInstance_
.getCoreTraceLevels();
if (coreTraceLevels.traceConnections() >= 2) {
String msg = "receiving transmission code sets";
msg += "\nchar code set: ";
if (codeConverters_.inputCharConverter != null)
msg += codeConverters_.inputCharConverter.getFrom().description;
else {
if (codeSetContext.char_data == 0)
msg += "none";
else {
CodeSetInfo info = db.getCodeSetInfo(orbInstance_
.getNativeCs());
msg += info != null ? info.description : null;
}
}
msg += "\nwchar code set: ";
if (codeConverters_.inputWcharConverter != null)
msg += codeConverters_.inputWcharConverter.getFrom().description;
else {
if (codeSetContext.wchar_data == 0)
msg += "none";
else {
CodeSetInfo info = db.getCodeSetInfo(orbInstance_
.getNativeWcs());
msg += info != null ? info.description : null;
}
}
orbInstance_.getLogger().trace("incoming", msg);
}
break;
}
}
}
/**
* set the OAInterface used by BiDir clients to handle requests
* @return true iff an OAInterface is found
*/
protected boolean setOAInterface(org.apache.yoko.orb.OCI.ProfileInfo pi) {
//
// Release the old OAInterface
//
oaInterface_ = null;
//
// make sure we're allowed to do server processing as well as
// being bidir enabled. A server's OAInterface should not
// change whereas a bidir client would need to change regularly
//
Assert._OB_assert((properties_ & Property.CreatedByClient) != 0);
Assert._OB_assert((properties_ & Property.ServerEnabled) != 0);
Assert._OB_assert(orbInstance_ != null);
org.apache.yoko.orb.OBPortableServer.POAManagerFactory poamanFactory = orbInstance_
.getPOAManagerFactory();
Assert._OB_assert(poamanFactory != null);
org.omg.PortableServer.POAManager[] poaManagers = poamanFactory.list();
for (POAManager poaManager : poaManagers) {
try {
POAManager_impl poamanImpl = (POAManager_impl) poaManager;
OAInterface oaImpl = poamanImpl
._OB_getOAInterface();
IORHolder refIOR = new IORHolder();
if (oaImpl.findByKey(pi.key, refIOR) == OAInterface.OBJECT_HERE) {
oaInterface_ = oaImpl;
return true;
}
} catch (ClassCastException ignore) {}
}
return false;
}
/** log the closing of this connection */
synchronized protected void logClose(boolean initiatedClosure) {
if ((properties_ & Property.ClosingLogged) != 0)
return;
properties_ |= Property.ClosingLogged;
CoreTraceLevels coreTraceLevels = orbInstance_.getCoreTraceLevels();
if (coreTraceLevels.traceConnections() > 0) {
org.apache.yoko.orb.OCI.TransportInfo info = transport_.get_info();
String msg = "closing connection\n";
msg += info.describe();
if (initiatedClosure)
orbInstance_.getLogger().trace("outgoing", msg);
else
orbInstance_.getLogger().trace("incoming", msg);
}
}
/** main entry point into message processing - delegate to a specific methods */
protected Upcall processMessage(GIOPIncomingMessage msg) {
//
// update the version of GIOP found
//
synchronized (this) {
if (msg.version().major > giopVersion_.major) {
giopVersion_.major = msg.version().major;
giopVersion_.minor = msg.version().minor;
} else if (msg.version().major == giopVersion_.major
&& msg.version().minor > giopVersion_.minor) {
giopVersion_.minor = msg.version().minor;
}
}
//
// hand off message type processing
//
switch (msg.type().value()) {
case org.omg.GIOP.MsgType_1_1._Reply:
processReply(msg);
break;
case org.omg.GIOP.MsgType_1_1._Request:
return processRequest(msg);
case org.omg.GIOP.MsgType_1_1._LocateRequest:
processLocateRequest(msg);
break;
case org.omg.GIOP.MsgType_1_1._CancelRequest:
break;
case org.omg.GIOP.MsgType_1_1._LocateReply:
processLocateReply(msg);
break;
case org.omg.GIOP.MsgType_1_1._CloseConnection:
processCloseConnection(msg);
break;
case org.omg.GIOP.MsgType_1_1._MessageError:
processMessageError(msg);
break;
case org.omg.GIOP.MsgType_1_1._Fragment:
processFragment(msg);
break;
default:
processException(
State.Error,
new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorUnknownMessage),
MinorCodes.MinorUnknownMessage,
CompletionStatus.COMPLETED_MAYBE),
false);
break;
}
return null;
}
/** process a request message */
synchronized protected Upcall processRequest(GIOPIncomingMessage msg) {
if ((properties_ & Property.ServerEnabled) == 0) {
processException(State.Error, new COMM_FAILURE(
MinorCodes
.describeCommFailure(MinorCodes.MinorWrongMessage),
MinorCodes.MinorWrongMessage,
CompletionStatus.COMPLETED_MAYBE), false);
return null;
}
if (state_ != State.Active)
return null;
int reqId;
org.omg.CORBA.BooleanHolder response = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.StringHolder op = new org.omg.CORBA.StringHolder();
org.omg.IOP.ServiceContextListHolder scl = new org.omg.IOP.ServiceContextListHolder();
org.omg.GIOP.TargetAddressHolder target = new org.omg.GIOP.TargetAddressHolder();
try {
reqId = msg.readRequestHeader(response, target, op, scl);
if (target.value.discriminator() != org.omg.GIOP.KeyAddr.value) {
processException(
State.Error,
new NO_IMPLEMENT(
MinorCodes
.describeNoImplement(MinorCodes.MinorNotSupportedByLocalObject),
MinorCodes.MinorNotSupportedByLocalObject,
CompletionStatus.COMPLETED_NO),
false);
return null;
}
} catch (SystemException ex) {
processException(State.Error, ex, false);
return null;
}
//
// Setup upcall data
//
org.omg.GIOP.Version version = msg.version();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = new org.apache.yoko.orb.OCI.ProfileInfo();
profileInfo.major = version.major;
profileInfo.minor = version.minor;
profileInfo.key = target.value.object_key();
org.apache.yoko.orb.CORBA.InputStream in = msg.input();
//
// We have some decision making to do here if BiDir is
// enabled:
// - If this is a client then make sure to properly
// evaluate the message and obtain the correct OAInterface
// to create the upcalls
// - If this is a server then take the listen points from
// the SCL (if the POA has the BiDir policy enabled) and
// store them in this' transport for connection reuse
//
if ((properties_ & Property.CreatedByClient) != 0) {
if (setOAInterface(profileInfo) == false) {
//
// we can't find an appropriate OAInterface in order
// to direct the upcall so we must simply not handle
// this request
//
return null;
}
}
//
// Parse the SCL, examining it for various codeset info
//
readCodeConverters(scl.value);
in._OB_codeConverters(codeConverters_, GiopVersion.get(version.major, version.minor));
//
// read in the peer's sending context runtime object
//
assignSendingContextRuntime(in, scl.value);
//
// New upcall will be started
//
if (response.value)
upcallsInProgress_++;
orbInstance_.getLogger().debug("Processing request reqId=" + reqId + " op=" + op.value);
return oaInterface_.createUpcall(
response.value ? upcallReturnInterface() : null, profileInfo,
transport_.get_info(), reqId, op.value, in, scl.value);
}
/** process a reply message */
synchronized protected void processReply(GIOPIncomingMessage msg) {
if ((properties_ & Property.ClientEnabled) == 0) {
processException(State.Error, new COMM_FAILURE(
MinorCodes
.describeCommFailure(MinorCodes.MinorWrongMessage),
MinorCodes.MinorWrongMessage,
CompletionStatus.COMPLETED_MAYBE), false);
return;
}
int reqId;
org.omg.GIOP.ReplyStatusType_1_2Holder status = new org.omg.GIOP.ReplyStatusType_1_2Holder();
org.omg.IOP.ServiceContextListHolder scl = new org.omg.IOP.ServiceContextListHolder();
try {
reqId = msg.readReplyHeader(status, scl);
} catch (SystemException ex) {
processException(State.Error, ex, false);
return;
}
Downcall down = messageQueue_.findAndRemovePending(reqId);
if (down == null) {
//
// Request id is unknown
//
processException(State.Error, new COMM_FAILURE(
MinorCodes
.describeCommFailure(MinorCodes.MinorUnknownReqId)
+ ": " + reqId, MinorCodes.MinorUnknownReqId,
CompletionStatus.COMPLETED_MAYBE), false);
return;
}
down.setReplySCL(scl.value);
org.apache.yoko.orb.CORBA.InputStream in = msg.input();
//
// read in the peer's sendig context runtime object
//
assignSendingContextRuntime(in, scl.value);
orbInstance_.getLogger().debug("Processing reply for reqId=" + reqId + " status=" + status.value.value());
switch (status.value.value()) {
case ReplyStatusType_1_2._NO_EXCEPTION:
down.setNoException(in);
break;
case ReplyStatusType_1_2._USER_EXCEPTION:
down.setUserException(in);
break;
case ReplyStatusType_1_2._SYSTEM_EXCEPTION: {
try {
SystemException ex = Util.unmarshalSystemException(in);
ex = convertToUnknownExceptionIfAppropriate(ex, in, scl.value);
down.setSystemException(ex);
} catch (SystemException ex) {
processException(State.Error, ex, false);
}
break;
}
case ReplyStatusType_1_2._LOCATION_FORWARD: {
try {
IOR ior = IORHelper.read(in);
down.setLocationForward(ior, false);
} catch (SystemException ex) {
processException(State.Error, ex, false);
}
break;
}
case ReplyStatusType_1_2._LOCATION_FORWARD_PERM: {
try {
IOR ior = IORHelper.read(in);
down.setLocationForward(ior, true);
break;
} catch (SystemException ex) {
processException(State.Error, ex, false);
}
}
case ReplyStatusType_1_2._NEEDS_ADDRESSING_MODE:
//
// TODO: implement
//
processException(
State.Error,
new NO_IMPLEMENT(
MinorCodes.describeNoImplement(MinorCodes.MinorNotSupportedByLocalObject),
MinorCodes.MinorNotSupportedByLocalObject,
CompletionStatus.COMPLETED_NO), false);
break;
default:
processException(
State.Error,
new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorUnknownReplyMessage),
MinorCodes.MinorUnknownReplyMessage,
CompletionStatus.COMPLETED_MAYBE),
false);
break;
}
}
private SystemException convertToUnknownExceptionIfAppropriate(SystemException ex, InputStream is,
ServiceContext[] scl) {
if (ex instanceof UNKNOWN) {
for (ServiceContext sc : scl) {
if (sc.context_id == UnknownExceptionInfo.value) {
return new UnresolvedException((UNKNOWN) ex, sc.context_data, is);
}
}
}
return ex;
}
private void assignSendingContextRuntime(InputStream in, ServiceContext[] scl) {
if (serverRuntime_ == null) {
serverRuntime_
= Util.getSendingContextRuntime (orbInstance_, scl);
}
in.__setSendingContextRuntime(serverRuntime_);
}
/** process a LocateRequest message */
synchronized protected void processLocateRequest(GIOPIncomingMessage msg) {
if ((properties_ & Property.ServerEnabled) == 0) {
processException(State.Error, new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorWrongMessage),
MinorCodes.MinorWrongMessage,
CompletionStatus.COMPLETED_MAYBE), false);
return;
}
Assert._OB_assert(state_ == State.Active);
//
// Make sure the transport can send a reply
//
if (transport_.mode() == org.apache.yoko.orb.OCI.SendReceiveMode.ReceiveOnly) {
String message = "Discarding locate request - transport "
+ "does not support twoway invocations";
org.apache.yoko.orb.OCI.TransportInfo transportInfo = transport_
.get_info();
if (transportInfo != null) {
String desc = transportInfo.describe();
message += '\n';
message += desc;
} else {
message += "\nCollocated method call";
}
Logger logger = orbInstance_.getLogger();
logger.warning(message);
return;
}
try {
int reqId;
org.omg.GIOP.TargetAddressHolder target = new org.omg.GIOP.TargetAddressHolder();
reqId = msg.readLocateRequestHeader(target);
if (target.value.discriminator() != org.omg.GIOP.KeyAddr.value) {
processException(
State.Error,
new NO_IMPLEMENT(
MinorCodes.describeNoImplement(MinorCodes.MinorNotSupportedByLocalObject),
MinorCodes.MinorNotSupportedByLocalObject,
CompletionStatus.COMPLETED_NO),
false);
return;
}
//
// Get the key
//
byte[] key = target.value.object_key();
//
// Find the IOR for the key
//
org.omg.IOP.IORHolder ior = new org.omg.IOP.IORHolder();
int val = oaInterface_.findByKey(key, ior);
LocateStatusType_1_2 status = LocateStatusType_1_2
.from_int(val);
//
// Send back locate reply message
//
org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
12);
buf.pos(12);
org.apache.yoko.orb.CORBA.OutputStream out = new org.apache.yoko.orb.CORBA.OutputStream(
buf);
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = new org.apache.yoko.orb.OCI.ProfileInfo();
profileInfo.major = msg.version().major;
profileInfo.minor = msg.version().minor;
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(
orbInstance_, out, profileInfo);
outgoing.writeLocateReplyHeader(reqId, status);
//
// If the reply status is OBJECT_FORWARD or
// OBJECT_FORWARD_PERM the IOR is appended to the end of the
// LocateReply.
//
if (status == LocateStatusType_1_2.OBJECT_FORWARD
|| status == LocateStatusType_1_2.OBJECT_FORWARD_PERM)
IORHelper.write(out, ior.value);
//
// TODO:
// LOC_SYSTEM_EXCEPTION,
// LOC_NEEDS_ADDRESSING_MODE
//
int pos = out._OB_pos();
out._OB_pos(0);
outgoing.writeMessageHeader(org.omg.GIOP.MsgType_1_1.LocateReply,
false, pos - 12);
out._OB_pos(pos);
//
// A locate request is treated just like an upcall
//
upcallsInProgress_++;
//
// Send the locate reply
//
sendUpcallReply(out._OB_buffer());
} catch (SystemException ex) {
processException(State.Error, ex, false);
}
}
/** process a LocateReply message */
synchronized protected void processLocateReply(GIOPIncomingMessage msg) {
if ((properties_ & Property.ClientEnabled) == 0) {
processException(State.Closed, new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorWrongMessage),
MinorCodes.MinorWrongMessage,
CompletionStatus.COMPLETED_MAYBE), false);
return;
}
int reqId;
org.omg.GIOP.LocateStatusType_1_2Holder status = new org.omg.GIOP.LocateStatusType_1_2Holder();
try {
reqId = msg.readLocateReplyHeader(status);
} catch (SystemException ex) {
processException(State.Error, ex, false);
return;
}
Downcall down = messageQueue_.findAndRemovePending(reqId);
if (down == null) {
//
// Request id is unknown
//
processException(State.Error, new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorUnknownReqId),
MinorCodes.MinorUnknownReqId,
CompletionStatus.COMPLETED_MAYBE), false);
return;
}
//
// Was this a LocateRequest?
//
String op = down.operation();
if (!op.equals("_locate")) {
processException(State.Error, new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorWrongMessage),
MinorCodes.MinorWrongMessage,
CompletionStatus.COMPLETED_MAYBE), false);
return;
}
org.apache.yoko.orb.CORBA.InputStream in = msg.input();
Logger logger = orbInstance_.getLogger();
switch (status.value.value()) {
case LocateStatusType_1_2._UNKNOWN_OBJECT:
down.setSystemException(new org.omg.CORBA.OBJECT_NOT_EXIST());
break;
case LocateStatusType_1_2._OBJECT_HERE:
down.setNoException(in);
break;
case LocateStatusType_1_2._OBJECT_FORWARD:
try {
IOR ior = IORHelper.read(in);
down.setLocationForward(ior, false);
if (logger.isDebugEnabled()) {
logger.debug("Locate request forwarded to " + IORDump.PrintObjref(orbInstance_.getORB(), ior));
}
} catch (SystemException ex) {
logger.warning("An error occurred while reading a "
+ "locate reply, possibly indicating\n"
+ "an interoperability problem. You may "
+ "need to set the LocateRequestPolicy\n"
+ "to false.");
down.setSystemException(ex);
processException(State.Error, ex, false);
}
break;
case LocateStatusType_1_2._OBJECT_FORWARD_PERM:
try {
IOR ior = IORHelper.read(in);
down.setLocationForward(ior, true);
if (logger.isDebugEnabled()) {
logger.debug("Locate request forwarded to " + IORDump.PrintObjref(orbInstance_.getORB(), ior));
}
} catch (SystemException ex) {
logger.warning("An error occurred while reading a "
+ "locate reply, possibly indicating\n"
+ "an interoperability problem. You may "
+ "need to set the LocateRequestPolicy\n"
+ "to false.");
down.setSystemException(ex);
processException(State.Error, ex, false);
}
break;
case LocateStatusType_1_2._LOC_SYSTEM_EXCEPTION:
try {
SystemException ex = SystemExceptionHelper.read(in);
down.setSystemException(ex);
} catch (SystemException ex) {
down.setSystemException(ex);
processException(State.Error, ex, false);
}
break;
case LocateStatusType_1_2._LOC_NEEDS_ADDRESSING_MODE:
// TODO: implement
processException(State.Error, new NO_IMPLEMENT(), false);
break;
}
}
/** process a CloseConnection message */
protected void processCloseConnection(GIOPIncomingMessage msg) {
orbInstance_.getLogger().debug("Close connection request received from peer");
if ((properties_ & Property.ClientEnabled) != 0) {
//
// If the peer closes the connection, all outstanding
// requests can safely be reissued. Thus we send all
// of them a TRANSIENT exception with a completion
// status of COMPLETED_NO. This is done by calling
// exception() with the notCompleted parameter set to
// true.
//
processException(
State.Closed,
new TRANSIENT(
MinorCodes.describeTransient(MinorCodes.MinorCloseConnection),
MinorCodes.MinorCloseConnection,
CompletionStatus.COMPLETED_NO), true);
} else {
setState(State.Closed);
}
}
/** process a MessageError message */
protected void processMessageError(GIOPIncomingMessage msg) {
processException(
State.Error,
new COMM_FAILURE(
MinorCodes.describeCommFailure(MinorCodes.MinorMessageError),
MinorCodes.MinorMessageError,
CompletionStatus.COMPLETED_NO), false);
}
/** process a Fragment message */
protected void processFragment(GIOPIncomingMessage msg) {
// At this point there should be no fragments, only complete messages.
Assert._OB_assert(false);
}
/** process a system exception */
protected boolean processException(int state,SystemException ex, boolean completed) {
Assert._OB_assert(state == State.Error || state == State.Closed);
orbInstance_.getLogger().debug("processing an exception, state=" + state, ex);
synchronized (this) {
//
// Don't do anything if there is no state change and it is
// not possible to transition backwards.
//
if (state <= state_)
return false;
//
// update the state
//
state_ = state;
// change the enabled/disable operations and break the cyclic dependency with GIOPClient
switch (state) {
case State.Error:
enabledOps_ &= ~(AccessOp.Read | AccessOp.Write);
enabledOps_ |= AccessOp.Close;
break;
case State.Closed:
enabledOps_ = AccessOp.Nil;
break;
}
orbInstance_.getOutboundConnectionCache().remove(outboundConnectionKey, this);
//
// propogate any exceptions to the message queue
//
messageQueue_.setException(state, ex, completed);
}
//
// apply the shutdown
//
switch (state) {
case State.Error:
abortiveShutdown();
break;
case State.Closed:
logClose(true);
transport_.close();
break;
}
//
// set 'this' properties
//
synchronized (this) {
properties_ |= Property.Destroyed;
}
//
// update the connection status
//
refresh();
return true;
}
/** transmits a reply back once the upcall completes */
protected void sendUpcallReply(org.apache.yoko.orb.OCI.Buffer buf) {
synchronized (this) {
//
// no need to do anything if we are closed
//
if (state_ == State.Closed)
return;
//
// decrement the number of upcalls in progress
//
Assert._OB_assert(upcallsInProgress_ > 0);
upcallsInProgress_--;
//
// add this message to the message Queue
//
messageQueue_.add(orbInstance_, buf);
}
//
// refresh the connection status
//
refresh();
//
// if that was the last upcall and we are in the closing state
// then shutdown now
//
synchronized (this) {
if (upcallsInProgress_ == 0 && state_ == State.Closing)
gracefulShutdown();
}
}
/** shutdown the connection forcefully and immediately */
abstract protected void abortiveShutdown();
/** shutdown the connection gracefully */
abstract protected void gracefulShutdown();
/** turn on ACM idle connection monitoring */
synchronized protected void ACM_enableIdleMonitor() {
if (idleTimeout_ > 0) {
acmTimer_ = new java.util.Timer(true);
acmTask_ = new ACMTask(this);
acmTimer_.schedule(acmTask_, idleTimeout_ * 1000);
}
}
/** turn off ACM idle connection monitoring */
synchronized protected void ACM_disableIdleMonitor() {
if (acmTimer_ != null) {
acmTimer_.cancel();
acmTimer_ = null;
}
if (acmTask_ != null) {
acmTask_.cancel();
acmTask_ = null;
}
}
// ----------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------
/** client-side constructor */
public GIOPConnection(ORBInstance orbInstance, Transport transport, GIOPClient client) {
//
// set member properties
//
nextRequestId = new AtomicInteger(0xA);
orbInstance_ = orbInstance;
transport_ = transport;
outboundConnectionKey = client.connectorInfo();
state_ = State.Active;
properties_ = Property.CreatedByClient | Property.ClientEnabled;
enabledOps_ = AccessOp.Read | AccessOp.Write;
//
// read ACM properties
//
String value;
java.util.Properties properties = orbInstance_.getProperties();
//
// the shutdown timeout for the client
//
value = properties.getProperty("yoko.orb.client_shutdown_timeout");
if (value != null)
shutdownTimeout_ = Integer.parseInt(value);
//
// the idle timeout for the client
//
value = properties.getProperty("yoko.orb.client_timeout");
if (value != null)
idleTimeout_ = Integer.parseInt(value);
//
// Trace new outgoing connection
//
CoreTraceLevels coreTraceLevels = orbInstance_.getCoreTraceLevels();
if (coreTraceLevels.traceConnections() > 0) {
org.apache.yoko.orb.OCI.TransportInfo info = transport_.get_info();
String msg = "new connection\n";
msg += info.describe();
orbInstance_.getLogger().trace("client-side", msg);
}
}
/** server-side constructor */
public GIOPConnection(ORBInstance orbInstance, Transport transport, OAInterface oa) {
//
// set members
//
nextRequestId = new AtomicInteger(0xB);
orbInstance_ = orbInstance;
transport_ = transport;
outboundConnectionKey = null;
oaInterface_ = oa;
properties_ = Property.ServerEnabled;
//
// read ACM properties
//
String value;
java.util.Properties properties = orbInstance_.getProperties();
//
// the shutdown timeout for the client
//
value = properties.getProperty("yoko.orb.server_shutdown_timeout");
if (value != null)
shutdownTimeout_ = Integer.parseInt(value);
//
// the idle timeout for the client
//
value = properties.getProperty("yoko.orb.server_timeout");
if (value != null)
idleTimeout_ = Integer.parseInt(value);
}
/** @return true iff this connection was initiated by the other party */
public final boolean isInbound() {
return (properties_ & Property.CreatedByClient) == 0;
}
/** @return true iff this connection was initiated by this party */
public final boolean isOutbound() {
return !!! isInbound();
}
/** @return the next request id to use */
public int getNewRequestId() {
// In the case of BiDir connections, the client should use
// even numbered requestIds and the server should use odd
// numbered requestIds... the += 2 keeps this pattern intact
// assuming its correct at startup
return nextRequestId.getAndAdd(2);
}
/** start populating the reply data */
public void upcallBeginReply(Upcall upcall, org.omg.IOP.ServiceContext[] scl) {
upcall.createOutputStream(12);
org.apache.yoko.orb.CORBA.OutputStream out = upcall.output();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = upcall.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_,
out, profileInfo);
int reqId = upcall.requestId();
try {
synchronized (this) {
outgoing.writeReplyHeader(reqId,
ReplyStatusType_1_2.NO_EXCEPTION, scl);
}
} catch (SystemException ex) {
//
// Nothing may go wrong here, otherwise we might have a
// recursion
//
Assert._OB_assert(ex);
}
}
/** finished reply construction; ready its return */
public void upcallEndReply(Upcall upcall) {
//
// Make sure the transport can send a reply
//
if (transport_.mode() == org.apache.yoko.orb.OCI.SendReceiveMode.ReceiveOnly) {
String msg = "Discarding reply - transport does not "
+ "support twoway invocations";
msg += "\noperation name: \"";
msg += upcall.operation();
msg += '"';
org.apache.yoko.orb.OCI.TransportInfo transportInfo = transport_
.get_info();
if (transportInfo != null) {
String desc = transportInfo.describe();
msg += '\n';
msg += desc;
} else {
msg += "\nCollocated method call";
}
Logger logger = orbInstance_.getLogger();
logger.warning(msg);
return;
}
org.apache.yoko.orb.CORBA.OutputStream out = upcall.output();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = upcall.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_,
out, profileInfo);
int pos = out._OB_pos();
out._OB_pos(0);
try {
outgoing.writeMessageHeader(org.omg.GIOP.MsgType_1_1.Reply, false,
pos - 12);
} catch (SystemException ex) {
//
// Nothing may go wrong here, otherwise we might have a
// recursion
//
Assert._OB_assert(ex);
}
sendUpcallReply(out._OB_buffer());
}
/** start populating the reply with a user exception */
public void upcallBeginUserException(Upcall upcall,
org.omg.IOP.ServiceContext[] scl) {
upcall.createOutputStream(12);
org.apache.yoko.orb.CORBA.OutputStream out = upcall.output();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = upcall.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_,
out, profileInfo);
int reqId = upcall.requestId();
try {
outgoing.writeReplyHeader(reqId,
ReplyStatusType_1_2.USER_EXCEPTION, scl);
} catch (SystemException ex) {
//
// Nothing may go wrong here, otherwise we might have a
// recursion
//
Assert._OB_assert(ex);
}
}
/** finished reply construction; ready its return */
public void upcallEndUserException(Upcall upcall) {
upcallEndReply(upcall);
}
/** populate and send the reply with a UserException */
public void upcallUserException(Upcall upcall,
org.omg.CORBA.UserException ex, org.omg.IOP.ServiceContext[] scl) {
upcall.createOutputStream(12);
org.apache.yoko.orb.CORBA.OutputStream out = upcall.output();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = upcall.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_,
out, profileInfo);
int reqId = upcall.requestId();
try {
outgoing.writeReplyHeader(reqId,
ReplyStatusType_1_2.USER_EXCEPTION, scl);
//
// Cannot marshal the exception without the Helper
//
// ex._OB_marshal(out);
Assert._OB_assert(false);
} catch (SystemException e) {
//
// Nothing may go wrong here, otherwise we might have a
// recursion
//
Assert._OB_assert(ex);
}
upcallEndReply(upcall);
}
/** populate and end the reply with a system exception */
public void upcallSystemException(Upcall upcall,
SystemException ex, org.omg.IOP.ServiceContext[] scl) {
upcall.createOutputStream(12);
org.apache.yoko.orb.CORBA.OutputStream out = upcall.output();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = upcall.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_,
out, profileInfo);
int reqId = upcall.requestId();
try {
// print this exception out here so applications have at stack trace to work
// cwith for problem determination.
orbInstance_.getLogger().debug("upcall exception", ex);
outgoing.writeReplyHeader(reqId,
ReplyStatusType_1_2.SYSTEM_EXCEPTION, scl);
Util.marshalSystemException(out, ex);
} catch (SystemException e) {
//
// Nothing may go wrong here, otherwise we might have a
// recursion
//
Assert._OB_assert(ex);
}
upcallEndReply(upcall);
}
/** prepare the reply for location forwarding */
public void upcallForward(Upcall upcall, IOR ior, boolean perm,
org.omg.IOP.ServiceContext[] scl) {
upcall.createOutputStream(12);
org.apache.yoko.orb.CORBA.OutputStream out = upcall.output();
org.apache.yoko.orb.OCI.ProfileInfo profileInfo = upcall.profileInfo();
GIOPOutgoingMessage outgoing = new GIOPOutgoingMessage(orbInstance_,
out, profileInfo);
int reqId = upcall.requestId();
ReplyStatusType_1_2 status = perm ? ReplyStatusType_1_2.LOCATION_FORWARD_PERM
: ReplyStatusType_1_2.LOCATION_FORWARD;
try {
outgoing.writeReplyHeader(reqId, status, scl);
Logger logger = orbInstance_.getLogger();
if (logger.isDebugEnabled()) {
logger.debug("Sending forward reply to " + IORDump.PrintObjref(orbInstance_.getORB(), ior));
}
IORHelper.write(out, ior);
} catch (SystemException ex) {
//
// Nothing may go wrong here, otherwise we might have a
// recursion
//
Assert._OB_assert(ex);
}
upcallEndReply(upcall);
}
/** enable this connection for processing as a client */
synchronized public void activateClientSide() {
properties_ |= Property.ClientEnabled;
enableConnectionModes(true, true);
}
/** enable this connection for processing as a server */
synchronized public void activateServerSide() {
Assert._OB_assert((properties_ & Property.CreatedByClient) != 0);
if ((properties_ & Property.ServerEnabled) == 0) {
properties_ |= Property.ServerEnabled;
enableConnectionModes(true, true);
}
}
/** @return a reference to the DowncallEmitter interface */
public DowncallEmitter emitterInterface() {
Assert._OB_assert((properties_ & Property.ClientEnabled) != 0);
return this;
}
/** @return a reference to the UpcallReturn interface */
public UpcallReturn upcallReturnInterface() {
Assert._OB_assert((properties_ & Property.ServerEnabled) != 0);
return this;
}
/** return the transport we represent */
public Transport transport() {
return transport_;
}
/** get the state of this connection */
synchronized public int state() {
Assert._OB_assert(state_ >= State.Active && state_ <= State.Closed);
return state_;
}
/** check if a request has been sent yet */
synchronized public boolean requestSent() {
return (properties_ & Property.RequestSent) != 0;
}
/** check if a reply has been sent yet */
synchronized public boolean replySent() {
return (properties_ & Property.ReplySent) != 0;
}
/** check if this connection was already destroyed */
synchronized public boolean destroyed() {
return (properties_ & Property.Destroyed) != 0;
}
/** change the state of this connection */
public void setState(int newState) {
synchronized (this) {
if (state_ == newState
|| (state_ != State.Holding && newState < state_)) {
logger.fine("No state change from " +state_ + " to " + newState);
return;
}
//
// make sure to update the state since some of the actions
// will key off this new state
//
state_ = newState;
}
switch (newState) {
case State.Active:
//
// set the new accessable operations
//
synchronized (this) {
enabledOps_ = AccessOp.Read | AccessOp.Write;
}
//
// start and refresh the connection
start();
refresh();
break;
case State.Holding:
//
// holding connections can't read new messages but can write
// pending messages
//
synchronized (this) {
enabledOps_ &= ~AccessOp.Read;
}
//
// pause the connection
//
pause();
break;
case State.Closing:
//
// during the closing, the connection can read/write/close
//
synchronized (this) {
enabledOps_ = AccessOp.All;
}
//
// gracefully shutdown by sending off pending messages,
// reading any messages left on the wire and then closing
//
gracefulShutdown();
//
// refresh this status
//
refresh();
break;
case State.Error:
//
// we can't read or write in the error state but we can
// close ourself down
//
synchronized (this) {
enabledOps_ = AccessOp.Close;
}
//
// there is an error so shutdown abortively
//
abortiveShutdown();
//
// mark the connection as destroyed now
//
synchronized (this) {
properties_ |= Property.Destroyed;
}
//
// refresh the connection status
//
refresh();
break;
case State.Closed:
//
// once closed, nothing else can take place
//
synchronized (this) {
enabledOps_ = AccessOp.Nil;
}
//
// log the connection closure
//
logClose(true);
//
// close the transport
//
transport_.close();
//
// mark the connection as destroyed
//
synchronized (this) {
properties_ |= Property.Destroyed;
}
//
// and refresh the connection
//
refresh();
break;
default:
Assert._OB_assert(false);
break;
}
}
/** destroy this connection */
public void destroy() {
setState(State.Closing);
}
/** callback method when the ACM signals a timeout */
abstract public void ACM_callback();
/** activate the connection */
abstract public void start();
/** refresh the connection status after a change in internal state */
abstract public void refresh();
/** tell the connection to stop processing; resumable with a refresh() */
abstract public void pause();
/** change the connection mode to [client, server, both] */
abstract public void enableConnectionModes(boolean enableClient, boolean enableServer);
}
| 6,393 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/BootManagerOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/BootManager:1.0
//
/**
*
* Interface to manage bootstrapping of objects.
*
**/
public interface BootManagerOperations
{
//
// IDL:orb.yoko.apache.org/OB/BootManager/add_binding:1.0
//
/**
*
* Add a new binding to the internal table.
*
* @param oid The object id to bind.
*
* @param obj The object reference.
*
* @exception org.apache.yoko.orb.OB.BootManagerPackage.AlreadyExists Thrown if binding already exists.
*
**/
void
add_binding(byte[] oid,
org.omg.CORBA.Object obj)
throws org.apache.yoko.orb.OB.BootManagerPackage.AlreadyExists;
//
// IDL:orb.yoko.apache.org/OB/BootManager/remove_binding:1.0
//
/**
*
* Remove a binding from the internal table.
*
* @param oid The object id to remove.
*
* @exception org.apache.yoko.orb.OB.BootManagerPackage.NotFound Thrown if no binding found.
*
**/
void
remove_binding(byte[] oid)
throws org.apache.yoko.orb.OB.BootManagerPackage.NotFound;
//
// IDL:orb.yoko.apache.org/OB/BootManager/set_locator:1.0
//
/**
*
* Set the BootLocator. The BootLocator is called when a binding
* for an object id does not exist in the internal table.
*
* @param locator The BootLocator reference.
*
* @see BootLocator
*
**/
void
set_locator(BootLocator locator);
}
| 6,394 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CodeConverterFrom.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final class CodeConverterFrom extends CodeConverterBase {
//
// Unicode character mapping table
//
private CharMapInfo fromMap_;
// ------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------
CodeConverterFrom(CodeSetInfo fromSet, CodeSetInfo toSet,
CharMapInfo fromMap) {
super(fromSet, toSet);
fromMap_ = fromMap;
}
// ------------------------------------------------------------------
// Public member implementations
// ------------------------------------------------------------------
public boolean conversionRequired() {
return true;
}
public char convert(char v) {
if (v <= (char) fromMap_.upper_bound) {
return (char) fromMap_.map_values[v];
}
return v;
}
}
| 6,395 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/LOCATION_TRANSPARENCY_RELAXED.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// IDL:orb.yoko.apache.org/OB/LOCATION_TRANSPARENCY_RELAXED:1.0
//
/**
*
* The <code>LOCATION_TRANSPARENCY_RELAXED</code>
* LocationTransparencyPolicy value.
*
**/
public interface LOCATION_TRANSPARENCY_RELAXED
{
short value = (short)(1L);
}
| 6,396 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/CORBANameParser.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
//
// This class parses the fields of an CORBANAME stringified name. Pass
// as string or octet sequence to the constructor. The isValid()
// method determines if the path is a valid stringified name. The
// getContents() method returns a string sequence of {id, kind} pairs.
//
public class CORBANameParser {
byte[] path_;
int curr_ = 0;
byte terminator_ = 0;
String[] contents_;
boolean valid_ = true;
private String next() {
String field = new String();
while (curr_ < path_.length && valid_) {
byte ch = path_[curr_];
if (ch == '.' || ch == '/') {
++curr_;
terminator_ = ch;
return field;
}
//
// Escape character? '.', '/' and '\' are
// permitted to follow.
//
if (ch == '\\') {
++curr_;
if (curr_ >= path_.length) {
valid_ = false;
continue;
}
ch = path_[curr_];
if (ch != '.' && ch != '/' && ch != '\\') {
valid_ = false;
continue;
}
}
field += (char) ch;
++curr_;
}
terminator_ = 0;
return field;
}
private boolean atEnd() {
return curr_ >= path_.length;
}
private byte terminator() {
return terminator_;
}
private void parse() {
java.util.Vector vec = new java.util.Vector();
while (!atEnd() && valid_) {
String id = next();
String kind;
//
// If the terminator is a '.' then the next field is the
// kind.
//
if (terminator() == '.') {
kind = next();
//
// The kind field is not permitted to end with a '.'.
//
if (terminator() == '.')
valid_ = false;
} else
kind = new String();
if (valid_) {
vec.addElement(id);
vec.addElement(kind);
}
}
if (valid_) {
contents_ = new String[vec.size()];
for (int i = 0; i < vec.size(); i++)
contents_[i] = (String) vec.elementAt(i);
}
}
public CORBANameParser(byte[] path) {
path_ = path;
parse();
}
public CORBANameParser(String path) {
path_ = new byte[path.length()];
for (int i = 0; i < path.length(); i++) {
if (path.charAt(i) > 255) {
valid_ = false;
break;
}
path_[i] = (byte) path.charAt(i);
}
parse();
}
public boolean isValid() {
return valid_;
}
public String[] getContents() {
return contents_;
}
}
| 6,397 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/Server.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
abstract public class Server {
//
// The concurrency model for this Server
//
final public static int Blocking = 0;
final public static int Threaded = 2;
protected int concModel_ = Blocking;
// ----------------------------------------------------------------------
// Server package member implementations
// ----------------------------------------------------------------------
Server(int concModel) {
concModel_ = concModel;
}
//
// Destroy the server
//
abstract void destroy();
//
// Hold any new requests that arrive for the Server
//
abstract void hold();
//
// Dispatch any requests that arrive for the Server
//
abstract void activate();
}
| 6,398 |
0 | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb | Create_ds/geronimo-yoko/yoko-core/src/main/java/org/apache/yoko/orb/OB/ParameterDesc.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.yoko.orb.OB;
final public class ParameterDesc {
public org.omg.CORBA.portable.Streamable param; // The parameter
public org.omg.CORBA.TypeCode tc; // The typecode of the parameter
public int mode; // CORBA::ParameterMode
public ParameterDesc(org.omg.CORBA.portable.Streamable param,
org.omg.CORBA.TypeCode tc, int mode) {
this.param = param;
this.tc = tc;
this.mode = mode;
}
}
| 6,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.